[InstCombine] Signed saturation patterns
[llvm-core.git] / test / MC / Mips / cprestore-noreorder.s
blobcd7a8c0b84e5a66cfaa27d1307f07d8c59bc8a23
1 # RUN: llvm-mc %s -triple mips-unknown-linux-gnu --position-independent \
2 # RUN: -show-encoding | FileCheck %s
4 # RUN: llvm-mc %s -triple mips-unknown-linux-gnu --position-independent \
5 # RUN: -filetype=obj -o - \
6 # RUN: | llvm-objdump -d -r - | FileCheck %s -check-prefix=CHECK-FOR-STORE
8 # RUN: llvm-mc %s -triple mips-unknown-linux-gnu -mattr=+micromips \
9 # RUN: --position-independent -show-encoding \
10 # RUN: | FileCheck %s -check-prefix=MICROMIPS
12 # RUN: llvm-mc %s -triple mips-unknown-linux-gnu -show-encoding \
13 # RUN: | FileCheck %s -check-prefix=NO-PIC
15 # RUN: llvm-mc %s -triple mips64-unknown-linux-gnuabin32 \
16 # RUN: --position-independent -show-encoding \
17 # RUN: | FileCheck %s -check-prefixes=BAD-ABI,BAD-ABI-N32
19 # RUN: llvm-mc %s -triple mips64-unknown-linux-gnu --position-independent \
20 # RUN: -show-encoding \
21 # RUN: | FileCheck %s -check-prefixes=BAD-ABI,BAD-ABI-N64
23 .text
24 .ent foo
25 foo:
26 .frame $sp, 0, $ra
27 .set noreorder
29 .cpload $25
30 .cprestore 8
32 jal $25
33 jal $4, $25
34 jal foo
36 .end foo
38 # CHECK-FOR-STORE: sw $gp, 8($sp)
40 # CHECK: .cprestore 8
41 # CHECK: jalr $25 # encoding: [0x03,0x20,0xf8,0x09]
42 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
43 # CHECK: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08]
45 # CHECK: jalr $4, $25 # encoding: [0x03,0x20,0x20,0x09]
46 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
47 # CHECK: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08]
49 # CHECK: lw $25, %got(foo)($gp) # encoding: [0x8f,0x99,A,A]
50 # CHECK: # fixup A - offset: 0, value: %got(foo), kind: fixup_Mips_GOT
51 # CHECK: addiu $25, $25, %lo(foo) # encoding: [0x27,0x39,A,A]
52 # CHECK: # fixup A - offset: 0, value: %lo(foo), kind: fixup_Mips_LO16
53 # CHECK: jalr $25 # encoding: [0x03,0x20,0xf8,0x09]
54 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
55 # CHECK: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08]
56 # CHECK: .end foo
58 # MICROMIPS: .cprestore 8
59 # MICROMIPS: jalrs16 $25 # encoding: [0x45,0xf9]
60 # MICROMIPS: nop # encoding: [0x00,0x00,0x00,0x00]
61 # MICROMIPS: lw $gp, 8($sp) # encoding: [0xff,0x9d,0x00,0x08]
63 # MICROMIPS: jalrs $4, $25 # encoding: [0x00,0x99,0x4f,0x3c]
64 # MICROMIPS: nop # encoding: [0x00,0x00,0x00,0x00]
65 # MICROMIPS: lw $gp, 8($sp) # encoding: [0xff,0x9d,0x00,0x08]
67 # MICROMIPS: lw $25, %got(foo)($gp) # encoding: [0xff,0x3c,A,A]
68 # MICROMIPS: # fixup A - offset: 0, value: %got(foo), kind: fixup_MICROMIPS_GOT16
69 # MICROMIPS: addiu $25, $25, %lo(foo) # encoding: [0x33,0x39,A,A]
70 # MICROMIPS: # fixup A - offset: 0, value: %lo(foo), kind: fixup_MICROMIPS_LO16
71 # MICROMIPS: jalrs $ra, $25 # encoding: [0x03,0xf9,0x4f,0x3c]
72 # MICROMIPS: nop # encoding: [0x0c,0x00]
73 # MICROMIPS: lw $gp, 8($sp) # encoding: [0xff,0x9d,0x00,0x08]
74 # MICROMIPS: .end foo
76 # NO-PIC: .cprestore 8
77 # NO-PIC: jalr $25 # encoding: [0x03,0x20,0xf8,0x09]
78 # NO-PIC-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08]
80 # NO-PIC: jalr $4, $25 # encoding: [0x03,0x20,0x20,0x09]
81 # NO-PIC-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08]
83 # NO-PIC: jal foo # encoding: [0b000011AA,A,A,A]
84 # NO-PIC: # fixup A - offset: 0, value: foo, kind: fixup_Mips_26
85 # NO-PIC-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08]
86 # NO-PIC: .end foo
88 # BAD-ABI: .cprestore 8
89 # BAD-ABI: jalr $25 # encoding: [0x03,0x20,0xf8,0x09]
90 # BAD-ABI-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08]
92 # BAD-ABI: jalr $4, $25 # encoding: [0x03,0x20,0x20,0x09]
93 # BAD-ABI-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08]
95 # BAD-ABI-N32: lw $25, %got_disp(foo)($gp) # encoding: [0x8f,0x99,A,A]
96 # BAD-ABI-N64: ld $25, %got_disp(foo)($gp) # encoding: [0xdf,0x99,A,A]
97 # BAD-ABI: # fixup A - offset: 0, value: %got_disp(foo), kind: fixup_Mips_GOT_DISP
98 # BAD-ABI: jalr $25 # encoding: [0x03,0x20,0xf8,0x09]
99 # BAD-ABI-NOT: lw $gp, 8($sp) # encoding: [0x8f,0xbc,0x00,0x08]
100 # BAD-ABI: .end foo