1// RUN: not llvm-mc -triple aarch64 -mattr +brbe -show-encoding %s 2>%t | FileCheck %s 2// RUN: FileCheck --check-prefix=ERROR %s < %t 3// RUN: not llvm-mc -triple aarch64 -show-encoding %s 2>%t 4// RUN: FileCheck --check-prefix=ERROR-NO-BRBE %s < %t 5 6msr BRBCR_EL1, x0 7mrs x1, BRBCR_EL1 8// CHECK: msr BRBCR_EL1, x0 // encoding: [0x00,0x90,0x11,0xd5] 9// CHECK: mrs x1, BRBCR_EL1 // encoding: [0x01,0x90,0x31,0xd5] 10// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 11// ERROR-NO-BRBE: [[@LINE-4]]:9: error: expected readable system register 12 13msr BRBCR_EL12, x2 14mrs x3, BRBCR_EL12 15// CHECK: msr BRBCR_EL12, x2 // encoding: [0x02,0x90,0x15,0xd5] 16// CHECK: mrs x3, BRBCR_EL12 // encoding: [0x03,0x90,0x35,0xd5] 17// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 18// ERROR-NO-BRBE: [[@LINE-4]]:9: error: expected readable system register 19 20msr BRBCR_EL2, x4 21mrs x5, BRBCR_EL2 22// CHECK: msr BRBCR_EL2, x4 // encoding: [0x04,0x90,0x14,0xd5] 23// CHECK: mrs x5, BRBCR_EL2 // encoding: [0x05,0x90,0x34,0xd5] 24// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 25// ERROR-NO-BRBE: [[@LINE-4]]:9: error: expected readable system register 26 27msr BRBFCR_EL1, x6 28mrs x7, BRBFCR_EL1 29// CHECK: msr BRBFCR_EL1, x6 // encoding: [0x26,0x90,0x11,0xd5] 30// CHECK: mrs x7, BRBFCR_EL1 // encoding: [0x27,0x90,0x31,0xd5] 31// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 32// ERROR-NO-BRBE: [[@LINE-4]]:9: error: expected readable system register 33 34msr BRBIDR0_EL1, x8 35mrs x9, BRBIDR0_EL1 36// ERROR: [[@LINE-2]]:5: error: expected writable system register 37// CHECK: mrs x9, BRBIDR0_EL1 // encoding: [0x09,0x92,0x31,0xd5] 38// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 39// ERROR-NO-BRBE: [[@LINE-4]]:9: error: expected readable system register 40 41msr BRBINFINJ_EL1, x10 42mrs x11, BRBINFINJ_EL1 43// CHECK: msr BRBINFINJ_EL1, x10 // encoding: [0x0a,0x91,0x11,0xd5] 44// CHECK: mrs x11, BRBINFINJ_EL1 // encoding: [0x0b,0x91,0x31,0xd5] 45// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 46// ERROR-NO-BRBE: [[@LINE-4]]:10: error: expected readable system register 47 48msr BRBSRCINJ_EL1, x12 49mrs x13, BRBSRCINJ_EL1 50// CHECK: msr BRBSRCINJ_EL1, x12 // encoding: [0x2c,0x91,0x11,0xd5] 51// CHECK: mrs x13, BRBSRCINJ_EL1 // encoding: [0x2d,0x91,0x31,0xd5] 52// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 53// ERROR-NO-BRBE: [[@LINE-4]]:10: error: expected readable system register 54 55msr BRBTGTINJ_EL1, x14 56mrs x15, BRBTGTINJ_EL1 57// CHECK: msr BRBTGTINJ_EL1, x14 // encoding: [0x4e,0x91,0x11,0xd5] 58// CHECK: mrs x15, BRBTGTINJ_EL1 // encoding: [0x4f,0x91,0x31,0xd5] 59// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 60// ERROR-NO-BRBE: [[@LINE-4]]:10: error: expected readable system register 61 62msr BRBTS_EL1, x16 63mrs x17, BRBTS_EL1 64// CHECK: msr BRBTS_EL1, x16 // encoding: [0x50,0x90,0x11,0xd5] 65// CHECK: mrs x17, BRBTS_EL1 // encoding: [0x51,0x90,0x31,0xd5] 66// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 67// ERROR-NO-BRBE: [[@LINE-4]]:10: error: expected readable system register 68 69// Rather than testing all 32 registers in the three BRBINF/BRBSRC/BRBTGT 70// families, I'll test a representative sample, including all bits clear, 71// all bits set, each bit set individually, and a couple of intermediate 72// patterns. 73 74msr BRBINF0_EL1, x18 75mrs x19, BRBINF0_EL1 76// ERROR: [[@LINE-2]]:5: error: expected writable system register 77// CHECK: mrs x19, BRBINF0_EL1 // encoding: [0x13,0x80,0x31,0xd5] 78// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 79// ERROR-NO-BRBE: [[@LINE-4]]:10: error: expected readable system register 80 81msr BRBINF1_EL1, x20 82mrs x21, BRBINF1_EL1 83// ERROR: [[@LINE-2]]:5: error: expected writable system register 84// CHECK: mrs x21, BRBINF1_EL1 // encoding: [0x15,0x81,0x31,0xd5] 85// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 86// ERROR-NO-BRBE: [[@LINE-4]]:10: error: expected readable system register 87 88msr BRBINF2_EL1, x22 89mrs x23, BRBINF2_EL1 90// ERROR: [[@LINE-2]]:5: error: expected writable system register 91// CHECK: mrs x23, BRBINF2_EL1 // encoding: [0x17,0x82,0x31,0xd5] 92// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 93// ERROR-NO-BRBE: [[@LINE-4]]:10: error: expected readable system register 94 95msr BRBSRC4_EL1, x24 96mrs x25, BRBSRC4_EL1 97// ERROR: [[@LINE-2]]:5: error: expected writable system register 98// CHECK: mrs x25, BRBSRC4_EL1 // encoding: [0x39,0x84,0x31,0xd5] 99// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 100// ERROR-NO-BRBE: [[@LINE-4]]:10: error: expected readable system register 101 102msr BRBSRC8_EL1, x26 103mrs x27, BRBSRC8_EL1 104// ERROR: [[@LINE-2]]:5: error: expected writable system register 105// CHECK: mrs x27, BRBSRC8_EL1 // encoding: [0x3b,0x88,0x31,0xd5] 106// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 107// ERROR-NO-BRBE: [[@LINE-4]]:10: error: expected readable system register 108 109msr BRBSRC16_EL1, x28 110mrs x29, BRBSRC16_EL1 111// ERROR: [[@LINE-2]]:5: error: expected writable system register 112// CHECK: mrs x29, BRBSRC16_EL1 // encoding: [0xbd,0x80,0x31,0xd5] 113// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 114// ERROR-NO-BRBE: [[@LINE-4]]:10: error: expected readable system register 115 116msr BRBTGT10_EL1, x0 117mrs x1, BRBTGT10_EL1 118// ERROR: [[@LINE-2]]:5: error: expected writable system register 119// CHECK: mrs x1, BRBTGT10_EL1 // encoding: [0x41,0x8a,0x31,0xd5] 120// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 121// ERROR-NO-BRBE: [[@LINE-4]]:9: error: expected readable system register 122 123msr BRBTGT21_EL1, x2 124mrs x3, BRBTGT21_EL1 125// ERROR: [[@LINE-2]]:5: error: expected writable system register 126// CHECK: mrs x3, BRBTGT21_EL1 // encoding: [0xc3,0x85,0x31,0xd5] 127// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 128// ERROR-NO-BRBE: [[@LINE-4]]:9: error: expected readable system register 129 130msr BRBTGT31_EL1, x4 131mrs x5, BRBTGT31_EL1 132// ERROR: [[@LINE-2]]:5: error: expected writable system register 133// CHECK: mrs x5, BRBTGT31_EL1 // encoding: [0xc5,0x8f,0x31,0xd5] 134// ERROR-NO-BRBE: [[@LINE-4]]:5: error: expected writable system register 135// ERROR-NO-BRBE: [[@LINE-4]]:9: error: expected readable system register 136 137brb iall 138brb inj 139// CHECK: brb iall // encoding: [0x9f,0x72,0x09,0xd5] 140// CHECK: brb inj // encoding: [0xbf,0x72,0x09,0xd5] 141// ERROR-NO-BRBE: [[@LINE-4]]:1: error: instruction requires: brbe 142// ERROR-NO-BRBE: [[@LINE-4]]:1: error: instruction requires: brbe 143 144brb IALL 145brb INJ 146// CHECK: brb iall // encoding: [0x9f,0x72,0x09,0xd5] 147// CHECK: brb inj // encoding: [0xbf,0x72,0x09,0xd5] 148// ERROR-NO-BRBE: [[@LINE-4]]:1: error: instruction requires: brbe 149// ERROR-NO-BRBE: [[@LINE-4]]:1: error: instruction requires: brbe 150