1 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 4 5 # Register operands 6 7 # CHECK-BE: add 1, 2, 3 # encoding: [0x7c,0x22,0x1a,0x14] 8 # CHECK-LE: add 1, 2, 3 # encoding: [0x14,0x1a,0x22,0x7c] 9 add 1, 2, 3 10 11 # CHECK-BE: add 1, 2, 3 # encoding: [0x7c,0x22,0x1a,0x14] 12 # CHECK-LE: add 1, 2, 3 # encoding: [0x14,0x1a,0x22,0x7c] 13 add %r1, %r2, %r3 14 15 # CHECK-BE: add 0, 0, 0 # encoding: [0x7c,0x00,0x02,0x14] 16 # CHECK-LE: add 0, 0, 0 # encoding: [0x14,0x02,0x00,0x7c] 17 add 0, 0, 0 18 19 # CHECK-BE: add 31, 31, 31 # encoding: [0x7f,0xff,0xfa,0x14] 20 # CHECK-LE: add 31, 31, 31 # encoding: [0x14,0xfa,0xff,0x7f] 21 add 31, 31, 31 22 23 # CHECK-BE: addi 1, 0, 0 # encoding: [0x38,0x20,0x00,0x00] 24 # CHECK-LE: addi 1, 0, 0 # encoding: [0x00,0x00,0x20,0x38] 25 addi 1, 0, 0 26 27 # CHECK-BE: addi 1, 0, 0 # encoding: [0x38,0x20,0x00,0x00] 28 # CHECK-LE: addi 1, 0, 0 # encoding: [0x00,0x00,0x20,0x38] 29 addi 1, %r0, 0 30 31 # Signed 16-bit immediate operands 32 33 # CHECK-BE: addi 1, 2, 0 # encoding: [0x38,0x22,0x00,0x00] 34 # CHECK-LE: addi 1, 2, 0 # encoding: [0x00,0x00,0x22,0x38] 35 addi 1, 2, 0 36 37 # CHECK-BE: addi 1, 0, -32768 # encoding: [0x38,0x20,0x80,0x00] 38 # CHECK-LE: addi 1, 0, -32768 # encoding: [0x00,0x80,0x20,0x38] 39 addi 1, 0, -32768 40 41 # CHECK-BE: addi 1, 0, 32767 # encoding: [0x38,0x20,0x7f,0xff] 42 # CHECK-LE: addi 1, 0, 32767 # encoding: [0xff,0x7f,0x20,0x38] 43 addi 1, 0, 32767 44 45 # Unsigned 16-bit immediate operands 46 47 # CHECK-BE: ori 1, 2, 0 # encoding: [0x60,0x41,0x00,0x00] 48 # CHECK-LE: ori 1, 2, 0 # encoding: [0x00,0x00,0x41,0x60] 49 ori 1, 2, 0 50 51 # CHECK-BE: ori 1, 2, 65535 # encoding: [0x60,0x41,0xff,0xff] 52 # CHECK-LE: ori 1, 2, 65535 # encoding: [0xff,0xff,0x41,0x60] 53 ori 1, 2, 65535 54 55 # Signed 16-bit immediate operands (extended range for addis) 56 57 # CHECK-BE: addis 1, 0, 0 # encoding: [0x3c,0x20,0x00,0x00] 58 # CHECK-LE: addis 1, 0, 0 # encoding: [0x00,0x00,0x20,0x3c] 59 addis 1, 0, -65536 60 61 # CHECK-BE: addis 1, 0, -1 # encoding: [0x3c,0x20,0xff,0xff] 62 # CHECK-LE: addis 1, 0, -1 # encoding: [0xff,0xff,0x20,0x3c] 63 addis 1, 0, 65535 64 65 # D-Form memory operands 66 67 # CHECK-BE: lwz 1, 0(0) # encoding: [0x80,0x20,0x00,0x00] 68 # CHECK-LE: lwz 1, 0(0) # encoding: [0x00,0x00,0x20,0x80] 69 lwz 1, 0(0) 70 71 # CHECK-BE: lwz 1, 0(0) # encoding: [0x80,0x20,0x00,0x00] 72 # CHECK-LE: lwz 1, 0(0) # encoding: [0x00,0x00,0x20,0x80] 73 lwz 1, 0(%r0) 74 75 # CHECK-BE: lwz 1, 0(31) # encoding: [0x80,0x3f,0x00,0x00] 76 # CHECK-LE: lwz 1, 0(31) # encoding: [0x00,0x00,0x3f,0x80] 77 lwz 1, 0(31) 78 79 # CHECK-BE: lwz 1, 0(31) # encoding: [0x80,0x3f,0x00,0x00] 80 # CHECK-LE: lwz 1, 0(31) # encoding: [0x00,0x00,0x3f,0x80] 81 lwz 1, 0(%r31) 82 83 # CHECK-BE: lwz 1, -32768(2) # encoding: [0x80,0x22,0x80,0x00] 84 # CHECK-LE: lwz 1, -32768(2) # encoding: [0x00,0x80,0x22,0x80] 85 lwz 1, -32768(2) 86 87 # CHECK-BE: lwz 1, 32767(2) # encoding: [0x80,0x22,0x7f,0xff] 88 # CHECK-LE: lwz 1, 32767(2) # encoding: [0xff,0x7f,0x22,0x80] 89 lwz 1, 32767(2) 90 91 92 # CHECK-BE: ld 1, 0(0) # encoding: [0xe8,0x20,0x00,0x00] 93 # CHECK-LE: ld 1, 0(0) # encoding: [0x00,0x00,0x20,0xe8] 94 ld 1, 0(0) 95 96 # CHECK-BE: ld 1, 0(0) # encoding: [0xe8,0x20,0x00,0x00] 97 # CHECK-LE: ld 1, 0(0) # encoding: [0x00,0x00,0x20,0xe8] 98 ld 1, 0(%r0) 99 100 # CHECK-BE: ld 1, 0(31) # encoding: [0xe8,0x3f,0x00,0x00] 101 # CHECK-LE: ld 1, 0(31) # encoding: [0x00,0x00,0x3f,0xe8] 102 ld 1, 0(31) 103 104 # CHECK-BE: ld 1, 0(31) # encoding: [0xe8,0x3f,0x00,0x00] 105 # CHECK-LE: ld 1, 0(31) # encoding: [0x00,0x00,0x3f,0xe8] 106 ld 1, 0(%r31) 107 108 # CHECK-BE: ld 1, -32768(2) # encoding: [0xe8,0x22,0x80,0x00] 109 # CHECK-LE: ld 1, -32768(2) # encoding: [0x00,0x80,0x22,0xe8] 110 ld 1, -32768(2) 111 112 # CHECK-BE: ld 1, 32764(2) # encoding: [0xe8,0x22,0x7f,0xfc] 113 # CHECK-LE: ld 1, 32764(2) # encoding: [0xfc,0x7f,0x22,0xe8] 114 ld 1, 32764(2) 115 116 # CHECK-BE: ld 1, 4(2) # encoding: [0xe8,0x22,0x00,0x04] 117 # CHECK-LE: ld 1, 4(2) # encoding: [0x04,0x00,0x22,0xe8] 118 ld 1, 4(2) 119 120 # CHECK-BE: ld 1, -4(2) # encoding: [0xe8,0x22,0xff,0xfc] 121 # CHECK-LE: ld 1, -4(2) # encoding: [0xfc,0xff,0x22,0xe8] 122 ld 1, -4(2) 123 124 125 # Immediate branch operands 126 127 # CHECK-BE: b .+1024 # encoding: [0x48,0x00,0x04,0x00] 128 # CHECK-LE: b .+1024 # encoding: [0x00,0x04,0x00,0x48] 129 b 1024 130 131 # CHECK-BE: ba 1024 # encoding: [0x48,0x00,0x04,0x02] 132 # CHECK-LE: ba 1024 # encoding: [0x02,0x04,0x00,0x48] 133 ba 1024 134 135 # CHECK-BE: beq 0, .+1024 # encoding: [0x41,0x82,0x04,0x00] 136 # CHECK-LE: beq 0, .+1024 # encoding: [0x00,0x04,0x82,0x41] 137 beq 1024 138 139 # CHECK-BE: beqa 0, 1024 # encoding: [0x41,0x82,0x04,0x02] 140 # CHECK-LE: beqa 0, 1024 # encoding: [0x02,0x04,0x82,0x41] 141 beqa 1024 142 143 # CHECK-BE: # encoding: [0x42,0x9f,A,0bAAAAAA01] 144 # CHECK-LE: # encoding: [0bAAAAAA01,A,0x9f,0x42] 145 bcl 20, 31, $+4 146 147 # CHECK-BE: # encoding: [0x42,0x00,A,0bAAAAAA00] 148 # CHECK-LE: # encoding: [0bAAAAAA00,A,0x00,0x42] 149 bdnz $-8 150 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 154 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 158 159