[DAGCombiner] Add target hook function to decide folding (mul (add x, c1), c2)
[llvm-project.git] / llvm / test / MC / Sparc / sparc-relocations.s
blob9acb1b34954a7570da229f85f8ca885014dd0e40
1 ! RUN: llvm-mc %s -arch=sparcv9 -show-encoding | FileCheck %s
2 ! RUN: llvm-mc %s -arch=sparcv9 -filetype=obj | llvm-readobj -r - | FileCheck %s --check-prefix=CHECK-OBJ
4 ! CHECK-OBJ: Format: elf64-sparc
5 ! CHECK-OBJ: Relocations [
6 ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_WDISP30 foo
7 ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_LO10 sym
8 ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_HI22 sym
9 ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_H44 sym
10 ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_M44 sym
11 ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_L44 sym
12 ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_HH22 sym
13 ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_HM10 sym
14 ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_LM22 sym
15 ! CHECK-OBJ: 0x{{[0-9,A-F]+}} R_SPARC_13 sym
16 ! CHECK-ELF: ]
18 ! CHECK: call foo ! encoding: [0b01AAAAAA,A,A,A]
19 ! CHECK: ! fixup A - offset: 0, value: foo, kind: fixup_sparc_call30
20 call foo
22 ! CHECK: or %g1, %lo(sym), %g3 ! encoding: [0x86,0x10,0b011000AA,A]
23 ! CHECK-NEXT: ! fixup A - offset: 0, value: %lo(sym), kind: fixup_sparc_lo10
24 or %g1, %lo(sym), %g3
26 ! CHECK: sethi %hi(sym), %l0 ! encoding: [0x21,0b00AAAAAA,A,A]
27 ! CHECK-NEXT: ! fixup A - offset: 0, value: %hi(sym), kind: fixup_sparc_hi22
28 sethi %hi(sym), %l0
30 ! CHECK: sethi %h44(sym), %l0 ! encoding: [0x21,0b00AAAAAA,A,A]
31 ! CHECK-NEXT: ! fixup A - offset: 0, value: %h44(sym), kind: fixup_sparc_h44
32 sethi %h44(sym), %l0
34 ! CHECK: or %g1, %m44(sym), %g3 ! encoding: [0x86,0x10,0b011000AA,A]
35 ! CHECK-NEXT: ! fixup A - offset: 0, value: %m44(sym), kind: fixup_sparc_m44
36 or %g1, %m44(sym), %g3
38 ! CHECK: or %g1, %l44(sym), %g3 ! encoding: [0x86,0x10,0b0110AAAA,A]
39 ! CHECK-NEXT: ! fixup A - offset: 0, value: %l44(sym), kind: fixup_sparc_l44
40 or %g1, %l44(sym), %g3
42 ! CHECK: sethi %hh(sym), %l0 ! encoding: [0x21,0b00AAAAAA,A,A]
43 ! CHECK-NEXT: ! fixup A - offset: 0, value: %hh(sym), kind: fixup_sparc_hh
44 sethi %hh(sym), %l0
46 ! CHECK: or %g1, %hm(sym), %g3 ! encoding: [0x86,0x10,0b011000AA,A]
47 ! CHECK-NEXT: ! fixup A - offset: 0, value: %hm(sym), kind: fixup_sparc_hm
48 or %g1, %hm(sym), %g3
50 ! CHECK: sethi %lm(sym), %l0 ! encoding: [0x21,0b00AAAAAA,A,A]
51 ! CHECK-NEXT: ! fixup A - offset: 0, value: %lm(sym), kind: fixup_sparc_lm
52 sethi %lm(sym), %l0
54 ! CHECK: or %g1, sym, %g3 ! encoding: [0x86,0x10,0b011AAAAA,A]
55 ! CHECK-NEXT: ! fixup A - offset: 0, value: sym, kind: fixup_sparc_13
56 or %g1, sym, %g3
58 ! CHECK: or %g1, sym+4, %g3 ! encoding: [0x86,0x10,0b011AAAAA,A]
59 ! CHECK-NEXT: ! fixup A - offset: 0, value: sym+4, kind: fixup_sparc_13
60 or %g1, (sym+4), %g3
62 ! This test needs to placed last in the file
63 ! CHECK: .half a-.Ltmp0
64 .half a - .
65 .byte a - .