2 # RUN: llvm-mc -triple powerpc64-unknown-unknown --show-encoding %s | FileCheck -check-prefix=CHECK-BE %s
3 # RUN: llvm-mc -triple powerpc64le-unknown-unknown --show-encoding %s | FileCheck -check-prefix=CHECK-LE %s
7 # CHECK-BE: add 1, 2, 3 # encoding: [0x7c,0x22,0x1a,0x14]
8 # CHECK-LE: add 1, 2, 3 # encoding: [0x14,0x1a,0x22,0x7c]
11 # CHECK-BE: add 1, 2, 3 # encoding: [0x7c,0x22,0x1a,0x14]
12 # CHECK-LE: add 1, 2, 3 # encoding: [0x14,0x1a,0x22,0x7c]
15 # CHECK-BE: add 0, 0, 0 # encoding: [0x7c,0x00,0x02,0x14]
16 # CHECK-LE: add 0, 0, 0 # encoding: [0x14,0x02,0x00,0x7c]
19 # CHECK-BE: add 31, 31, 31 # encoding: [0x7f,0xff,0xfa,0x14]
20 # CHECK-LE: add 31, 31, 31 # encoding: [0x14,0xfa,0xff,0x7f]
23 # CHECK-BE: addi 1, 0, 0 # encoding: [0x38,0x20,0x00,0x00]
24 # CHECK-LE: addi 1, 0, 0 # encoding: [0x00,0x00,0x20,0x38]
27 # CHECK-BE: addi 1, 0, 0 # encoding: [0x38,0x20,0x00,0x00]
28 # CHECK-LE: addi 1, 0, 0 # encoding: [0x00,0x00,0x20,0x38]
31 # Signed 16-bit immediate operands
33 # CHECK-BE: addi 1, 2, 0 # encoding: [0x38,0x22,0x00,0x00]
34 # CHECK-LE: addi 1, 2, 0 # encoding: [0x00,0x00,0x22,0x38]
37 # CHECK-BE: addi 1, 0, -32768 # encoding: [0x38,0x20,0x80,0x00]
38 # CHECK-LE: addi 1, 0, -32768 # encoding: [0x00,0x80,0x20,0x38]
41 # CHECK-BE: addi 1, 0, 32767 # encoding: [0x38,0x20,0x7f,0xff]
42 # CHECK-LE: addi 1, 0, 32767 # encoding: [0xff,0x7f,0x20,0x38]
45 # Unsigned 16-bit immediate operands
47 # CHECK-BE: ori 1, 2, 0 # encoding: [0x60,0x41,0x00,0x00]
48 # CHECK-LE: ori 1, 2, 0 # encoding: [0x00,0x00,0x41,0x60]
51 # CHECK-BE: ori 1, 2, 65535 # encoding: [0x60,0x41,0xff,0xff]
52 # CHECK-LE: ori 1, 2, 65535 # encoding: [0xff,0xff,0x41,0x60]
55 # Signed 16-bit immediate operands (extended range for addis)
57 # CHECK-BE: addis 1, 0, 0 # encoding: [0x3c,0x20,0x00,0x00]
58 # CHECK-LE: addis 1, 0, 0 # encoding: [0x00,0x00,0x20,0x3c]
61 # CHECK-BE: addis 1, 0, -1 # encoding: [0x3c,0x20,0xff,0xff]
62 # CHECK-LE: addis 1, 0, -1 # encoding: [0xff,0xff,0x20,0x3c]
65 # D-Form memory operands
67 # CHECK-BE: lwz 1, 0(0) # encoding: [0x80,0x20,0x00,0x00]
68 # CHECK-LE: lwz 1, 0(0) # encoding: [0x00,0x00,0x20,0x80]
71 # CHECK-BE: lwz 1, 0(0) # encoding: [0x80,0x20,0x00,0x00]
72 # CHECK-LE: lwz 1, 0(0) # encoding: [0x00,0x00,0x20,0x80]
75 # CHECK-BE: lwz 1, 0(31) # encoding: [0x80,0x3f,0x00,0x00]
76 # CHECK-LE: lwz 1, 0(31) # encoding: [0x00,0x00,0x3f,0x80]
79 # CHECK-BE: lwz 1, 0(31) # encoding: [0x80,0x3f,0x00,0x00]
80 # CHECK-LE: lwz 1, 0(31) # encoding: [0x00,0x00,0x3f,0x80]
83 # CHECK-BE: lwz 1, -32768(2) # encoding: [0x80,0x22,0x80,0x00]
84 # CHECK-LE: lwz 1, -32768(2) # encoding: [0x00,0x80,0x22,0x80]
87 # CHECK-BE: lwz 1, 32767(2) # encoding: [0x80,0x22,0x7f,0xff]
88 # CHECK-LE: lwz 1, 32767(2) # encoding: [0xff,0x7f,0x22,0x80]
92 # CHECK-BE: ld 1, 0(0) # encoding: [0xe8,0x20,0x00,0x00]
93 # CHECK-LE: ld 1, 0(0) # encoding: [0x00,0x00,0x20,0xe8]
96 # CHECK-BE: ld 1, 0(0) # encoding: [0xe8,0x20,0x00,0x00]
97 # CHECK-LE: ld 1, 0(0) # encoding: [0x00,0x00,0x20,0xe8]
100 # CHECK-BE: ld 1, 0(31) # encoding: [0xe8,0x3f,0x00,0x00]
101 # CHECK-LE: ld 1, 0(31) # encoding: [0x00,0x00,0x3f,0xe8]
104 # CHECK-BE: ld 1, 0(31) # encoding: [0xe8,0x3f,0x00,0x00]
105 # CHECK-LE: ld 1, 0(31) # encoding: [0x00,0x00,0x3f,0xe8]
108 # CHECK-BE: ld 1, -32768(2) # encoding: [0xe8,0x22,0x80,0x00]
109 # CHECK-LE: ld 1, -32768(2) # encoding: [0x00,0x80,0x22,0xe8]
112 # CHECK-BE: ld 1, 32764(2) # encoding: [0xe8,0x22,0x7f,0xfc]
113 # CHECK-LE: ld 1, 32764(2) # encoding: [0xfc,0x7f,0x22,0xe8]
116 # CHECK-BE: ld 1, 4(2) # encoding: [0xe8,0x22,0x00,0x04]
117 # CHECK-LE: ld 1, 4(2) # encoding: [0x04,0x00,0x22,0xe8]
120 # CHECK-BE: ld 1, -4(2) # encoding: [0xe8,0x22,0xff,0xfc]
121 # CHECK-LE: ld 1, -4(2) # encoding: [0xfc,0xff,0x22,0xe8]
125 # Immediate branch operands
127 # CHECK-BE: b .+1024 # encoding: [0x48,0x00,0x04,0x00]
128 # CHECK-LE: b .+1024 # encoding: [0x00,0x04,0x00,0x48]
131 # CHECK-BE: ba 1024 # encoding: [0x48,0x00,0x04,0x02]
132 # CHECK-LE: ba 1024 # encoding: [0x02,0x04,0x00,0x48]
135 # CHECK-BE: beq 0, .+1024 # encoding: [0x41,0x82,0x04,0x00]
136 # CHECK-LE: beq 0, .+1024 # encoding: [0x00,0x04,0x82,0x41]
139 # CHECK-BE: beqa 0, 1024 # encoding: [0x41,0x82,0x04,0x02]
140 # CHECK-LE: beqa 0, 1024 # encoding: [0x02,0x04,0x82,0x41]
143 # CHECK-BE: # encoding: [0x42,0x9f,A,0bAAAAAA01]
144 # CHECK-LE: # encoding: [0bAAAAAA01,A,0x9f,0x42]
147 # CHECK-BE: # encoding: [0x42,0x00,A,0bAAAAAA00]
148 # CHECK-LE: # encoding: [0bAAAAAA00,A,0x00,0x42]
151 # CHECK-BE: andi. 0, 3, 32767 # encoding: [0x70,0x60,0x7f,0xff]
152 # CHECK-LE: andi. 0, 3, 32767 # encoding: [0xff,0x7f,0x60,0x70]
153 andi. %r0,%r3,~
0x8000@
l
155 # CHECK-BE: andi. 0, 3, 0 # encoding: [0x70,0x60,0x00,0x00]
156 # CHECK-LE: andi. 0, 3, 0 # encoding: [0x00,0x00,0x60,0x70]
157 andi. %r0,%r3,!0x8000@
l