xref: /llvm-project/llvm/test/CodeGen/RISCV/relax-per-target-feature.ll (revision 7fee58acf4c81159655b30c503b773913966255c)
139ba027fSFangrui Song; RUN: llc -filetype=obj -mtriple=riscv64 %s -o %t
239ba027fSFangrui Song; RUN: llvm-objdump -dr -M no-aliases --mattr=+c %t | FileCheck %s
339ba027fSFangrui Song
439ba027fSFangrui Song;; Functions may have more features than the base triple; code generation and
539ba027fSFangrui Song;; instruction selection may be performed based on this information. This test
639ba027fSFangrui Song;; makes sure that the MC layer uses the target-features of the function.
739ba027fSFangrui Song
839ba027fSFangrui Songdeclare dso_local i32 @ext(i32)
939ba027fSFangrui Song
1039ba027fSFangrui Song; CHECK-LABEL: <f>:
11*7fee58acSCraig Topper; CHECK-NEXT:    c.li a0, 0x1f
12*7fee58acSCraig Topper; CHECK-NEXT:    auipc t1, 0x0
1339ba027fSFangrui Song; CHECK-NEXT:    R_RISCV_CALL_PLT     ext
14e87f33d9SCraig Topper; CHECK-NEXT:    R_RISCV_RELAX *ABS*
15*7fee58acSCraig Topper; CHECK-NEXT:    jalr zero, 0x0(t1)
1639ba027fSFangrui Songdefine dso_local i32 @f() #0 {
1739ba027fSFangrui Songentry:
1839ba027fSFangrui Song  %r = tail call i32 @ext(i32 31)
1939ba027fSFangrui Song  ret i32 %r
2039ba027fSFangrui Song}
2139ba027fSFangrui Song
2239ba027fSFangrui Song; CHECK-LABEL: <g>:
23*7fee58acSCraig Topper; CHECK-NEXT:    addi a0, zero, 0x1f
24*7fee58acSCraig Topper; CHECK-NEXT:    auipc t1, 0x0
2539ba027fSFangrui Song; CHECK-NEXT:    R_RISCV_CALL_PLT     ext
26*7fee58acSCraig Topper; CHECK-NEXT:    jalr zero, 0x0(t1)
2739ba027fSFangrui Songdefine dso_local i32 @g() #1 {
2839ba027fSFangrui Songentry:
2939ba027fSFangrui Song  %r = tail call i32 @ext(i32 31)
3039ba027fSFangrui Song  ret i32 %r
3139ba027fSFangrui Song}
3239ba027fSFangrui Song
3339ba027fSFangrui Songattributes #0 = { nounwind "target-features"="+c,+relax" }
3439ba027fSFangrui Songattributes #1 = { nounwind "target-features"="-c,-relax" }
35