1 2# RUN: llvm-mc -triple powerpc64-unknown-unknown --show-encoding %s | FileCheck %s 3 4# Register operands 5 6# CHECK: add 1, 2, 3 # encoding: [0x7c,0x22,0x1a,0x14] 7 add 1, 2, 3 8 9# CHECK: add 1, 2, 3 # encoding: [0x7c,0x22,0x1a,0x14] 10 add %r1, %r2, %r3 11 12# CHECK: add 0, 0, 0 # encoding: [0x7c,0x00,0x02,0x14] 13 add 0, 0, 0 14 15# CHECK: add 31, 31, 31 # encoding: [0x7f,0xff,0xfa,0x14] 16 add 31, 31, 31 17 18# CHECK: addi 1, 0, 0 # encoding: [0x38,0x20,0x00,0x00] 19 addi 1, 0, 0 20 21# CHECK: addi 1, 0, 0 # encoding: [0x38,0x20,0x00,0x00] 22 addi 1, %r0, 0 23 24# Signed 16-bit immediate operands 25 26# CHECK: addi 1, 2, 0 # encoding: [0x38,0x22,0x00,0x00] 27 addi 1, 2, 0 28 29# CHECK: addi 1, 0, -32768 # encoding: [0x38,0x20,0x80,0x00] 30 addi 1, 0, -32768 31 32# CHECK: addi 1, 0, 32767 # encoding: [0x38,0x20,0x7f,0xff] 33 addi 1, 0, 32767 34 35# Unsigned 16-bit immediate operands 36 37# CHECK: ori 1, 2, 0 # encoding: [0x60,0x41,0x00,0x00] 38 ori 1, 2, 0 39 40# CHECK: ori 1, 2, 65535 # encoding: [0x60,0x41,0xff,0xff] 41 ori 1, 2, 65535 42 43# Signed 16-bit immediate operands (extended range for addis) 44 45# CHECK: addis 1, 0, 0 # encoding: [0x3c,0x20,0x00,0x00] 46 addis 1, 0, -65536 47 48# CHECK: addis 1, 0, -1 # encoding: [0x3c,0x20,0xff,0xff] 49 addis 1, 0, 65535 50 51# D-Form memory operands 52 53# CHECK: lwz 1, 0(0) # encoding: [0x80,0x20,0x00,0x00] 54 lwz 1, 0(0) 55 56# CHECK: lwz 1, 0(0) # encoding: [0x80,0x20,0x00,0x00] 57 lwz 1, 0(%r0) 58 59# CHECK: lwz 1, 0(31) # encoding: [0x80,0x3f,0x00,0x00] 60 lwz 1, 0(31) 61 62# CHECK: lwz 1, 0(31) # encoding: [0x80,0x3f,0x00,0x00] 63 lwz 1, 0(%r31) 64 65# CHECK: lwz 1, -32768(2) # encoding: [0x80,0x22,0x80,0x00] 66 lwz 1, -32768(2) 67 68# CHECK: lwz 1, 32767(2) # encoding: [0x80,0x22,0x7f,0xff] 69 lwz 1, 32767(2) 70 71 72# CHECK: ld 1, 0(0) # encoding: [0xe8,0x20,0x00,0x00] 73 ld 1, 0(0) 74 75# CHECK: ld 1, 0(0) # encoding: [0xe8,0x20,0x00,0x00] 76 ld 1, 0(%r0) 77 78# CHECK: ld 1, 0(31) # encoding: [0xe8,0x3f,0x00,0x00] 79 ld 1, 0(31) 80 81# CHECK: ld 1, 0(31) # encoding: [0xe8,0x3f,0x00,0x00] 82 ld 1, 0(%r31) 83 84# CHECK: ld 1, -32768(2) # encoding: [0xe8,0x22,0x80,0x00] 85 ld 1, -32768(2) 86 87# CHECK: ld 1, 32764(2) # encoding: [0xe8,0x22,0x7f,0xfc] 88 ld 1, 32764(2) 89 90# CHECK: ld 1, 4(2) # encoding: [0xe8,0x22,0x00,0x04] 91 ld 1, 4(2) 92 93# CHECK: ld 1, -4(2) # encoding: [0xe8,0x22,0xff,0xfc] 94 ld 1, -4(2) 95 96 97# Immediate branch operands 98 99# CHECK: b .+1024 # encoding: [0x48,0x00,0x04,0x00] 100 b 1024 101 102# CHECK: ba 1024 # encoding: [0x48,0x00,0x04,0x02] 103 ba 1024 104 105# CHECK: beq 0, .+1024 # encoding: [0x41,0x82,0x04,0x00] 106 beq 1024 107 108# CHECK: beqa 0, 1024 # encoding: [0x41,0x82,0x04,0x02] 109 beqa 1024 110 111