[ARM] Handling for coprocessor instructions that are undefined starting from ARMv8 (Thumb encodings)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194263 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Artyom Skrobov 2013-11-08 16:25:50 +00:00
parent c5c991bf31
commit 2b01682aa7
4 changed files with 239 additions and 3000 deletions

View File

@ -3914,10 +3914,10 @@ defm t2LDC : t2LdStCop<0b1110, 1, 0, "ldc">;
defm t2LDCL : t2LdStCop<0b1110, 1, 1, "ldcl">;
defm t2STC : t2LdStCop<0b1110, 0, 0, "stc">;
defm t2STCL : t2LdStCop<0b1110, 0, 1, "stcl">;
defm t2LDC2 : t2LdStCop<0b1111, 1, 0, "ldc2">;
defm t2LDC2L : t2LdStCop<0b1111, 1, 1, "ldc2l">;
defm t2STC2 : t2LdStCop<0b1111, 0, 0, "stc2">;
defm t2STC2L : t2LdStCop<0b1111, 0, 1, "stc2l">;
defm t2LDC2 : t2LdStCop<0b1111, 1, 0, "ldc2">, Requires<[PreV8]>;
defm t2LDC2L : t2LdStCop<0b1111, 1, 1, "ldc2l">, Requires<[PreV8]>;
defm t2STC2 : t2LdStCop<0b1111, 0, 0, "stc2">, Requires<[PreV8]>;
defm t2STC2L : t2LdStCop<0b1111, 0, 1, "stc2l">, Requires<[PreV8]>;
//===----------------------------------------------------------------------===//
@ -4063,7 +4063,9 @@ def t2MCR2 : t2MovRCopro<0b1111, "mcr2", 0,
(outs), (ins p_imm:$cop, imm0_7:$opc1, GPR:$Rt, c_imm:$CRn,
c_imm:$CRm, imm0_7:$opc2),
[(int_arm_mcr2 imm:$cop, imm:$opc1, GPR:$Rt, imm:$CRn,
imm:$CRm, imm:$opc2)]>;
imm:$CRm, imm:$opc2)]> {
let Predicates = [IsThumb2, PreV8];
}
def : t2InstAlias<"mcr2${p} $cop, $opc1, $Rt, $CRn, $CRm",
(t2MCR2 p_imm:$cop, imm0_7:$opc1, GPR:$Rt, c_imm:$CRn,
c_imm:$CRm, 0, pred:$p)>;
@ -4078,7 +4080,9 @@ def : t2InstAlias<"mrc${p} $cop, $opc1, $Rt, $CRn, $CRm",
def t2MRC2 : t2MovRCopro<0b1111, "mrc2", 1,
(outs GPRwithAPSR:$Rt), (ins p_imm:$cop, imm0_7:$opc1, c_imm:$CRn,
c_imm:$CRm, imm0_7:$opc2), []>;
c_imm:$CRm, imm0_7:$opc2), []> {
let Predicates = [IsThumb2, PreV8];
}
def : t2InstAlias<"mrc2${p} $cop, $opc1, $Rt, $CRn, $CRm",
(t2MRC2 GPRwithAPSR:$Rt, p_imm:$cop, imm0_7:$opc1, c_imm:$CRn,
c_imm:$CRm, 0, pred:$p)>;
@ -4096,11 +4100,16 @@ def t2MCRR : t2MovRRCopro<0b1110, "mcrr", 0,
imm:$CRm)]>;
def t2MCRR2 : t2MovRRCopro<0b1111, "mcrr2", 0,
[(int_arm_mcrr2 imm:$cop, imm:$opc1, GPR:$Rt,
GPR:$Rt2, imm:$CRm)]>;
GPR:$Rt2, imm:$CRm)]> {
let Predicates = [IsThumb2, PreV8];
}
/* from coprocessor to ARM core register */
def t2MRRC : t2MovRRCopro<0b1110, "mrrc", 1>;
def t2MRRC2 : t2MovRRCopro<0b1111, "mrrc2", 1>;
def t2MRRC2 : t2MovRRCopro<0b1111, "mrrc2", 1> {
let Predicates = [IsThumb2, PreV8];
}
//===----------------------------------------------------------------------===//
// Other Coprocessor Instructions.
@ -4127,6 +4136,8 @@ def t2CDP : T2Cop<0b1110, (outs), (ins p_imm:$cop, imm0_15:$opc1,
let Inst{15-12} = CRd;
let Inst{19-16} = CRn;
let Inst{23-20} = opc1;
let Predicates = [IsThumb2, PreV8];
}
def t2CDP2 : T2Cop<0b1111, (outs), (ins p_imm:$cop, imm0_15:$opc1,
@ -4150,6 +4161,8 @@ def t2CDP2 : T2Cop<0b1111, (outs), (ins p_imm:$cop, imm0_15:$opc1,
let Inst{15-12} = CRd;
let Inst{19-16} = CRn;
let Inst{23-20} = opc1;
let Predicates = [IsThumb2, PreV8];
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,167 @@
# RUN: not llvm-mc -disassemble %s -show-encoding -triple thumbv8 2>&1 | FileCheck %s
# Coprocessors other than CP10, CP11, CP14 and CP15 are undefined in ARMv8;
# but in ARMv7, all these instructions are valid
# RUN: llvm-mc -triple thumbv7 -show-encoding -disassemble %s | FileCheck %s --check-prefix=CHECK-V7
[0x00 0xee 0x00 0x01]
# CHECK-V7: cdp
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x00 0xee 0x00 0x01]
[0x00 0xee 0x00 0x0e]
# CHECK-V7: cdp
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x00 0xee 0x00 0x0e]
[0x00 0xee 0x00 0x0f]
# CHECK-V7: cdp
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x00 0xee 0x00 0x0f]
[0x00 0xfe 0x00 0x01]
# CHECK-V7: cdp2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x00 0xfe 0x00 0x01]
[0x00 0xfe 0x00 0x0e]
# CHECK-V7: cdp2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x00 0xfe 0x00 0x0e]
[0x00 0xfe 0x00 0x0f]
# CHECK-V7: cdp2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x00 0xfe 0x00 0x0f]
[0x00 0xee 0x10 0x01]
# CHECK-V7: mcr
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x00 0xee 0x10 0x01]
[0x00 0xfe 0x10 0x01]
# CHECK-V7: mcr2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x00 0xfe 0x10 0x01]
[0x00 0xfe 0x10 0x0e]
# CHECK-V7: mcr2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x00 0xfe 0x10 0x0e]
[0x00 0xfe 0x10 0x0f]
# CHECK-V7: mcr2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x00 0xfe 0x10 0x0f]
[0x10 0xee 0x10 0x01]
# CHECK-V7: mrc
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x10 0xee 0x10 0x01]
[0x10 0xfe 0x10 0x01]
# CHECK-V7: mrc2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x10 0xfe 0x10 0x01]
[0x10 0xfe 0x10 0x0e]
# CHECK-V7: mrc2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x10 0xfe 0x10 0x0e]
[0x10 0xfe 0x10 0x0f]
# CHECK-V7: mrc2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x10 0xfe 0x10 0x0f]
[0x40 0xec 0x00 0x01]
# CHECK-V7: mcrr
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x40 0xec 0x00 0x01]
[0x40 0xfc 0x00 0x01]
# CHECK-V7: mcrr2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x40 0xfc 0x00 0x01]
[0x40 0xfc 0x00 0x0e]
# CHECK-V7: mcrr2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x40 0xfc 0x00 0x0e]
[0x40 0xfc 0x00 0x0f]
# CHECK-V7: mcrr2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x40 0xfc 0x00 0x0f]
[0x50 0xec 0x00 0x01]
# CHECK-V7: mrrc
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x50 0xec 0x00 0x01]
[0x50 0xfc 0x00 0x0e]
# CHECK-V7: mrrc2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x50 0xfc 0x00 0x0e]
[0x50 0xfc 0x00 0x0f]
# CHECK-V7: mrrc2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x50 0xfc 0x00 0x0f]
[0x50 0xfc 0x00 0x01]
# CHECK-V7: mrrc2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x50 0xfc 0x00 0x01]
[0x80 0xec 0x00 0x01]
# CHECK-V7: stc
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x80 0xec 0x00 0x01]
[0x80 0xec 0x00 0x0f]
# CHECK-V7: stc
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x80 0xec 0x00 0x0f]
[0x80 0xfc 0x00 0x01]
# CHECK-V7: stc2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x80 0xfc 0x00 0x01]
[0x80 0xfc 0x00 0x0e]
# CHECK-V7: stc2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x80 0xfc 0x00 0x0e]
[0x80 0xfc 0x00 0x0f]
# CHECK-V7: stc2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x80 0xfc 0x00 0x0f]
[0x90 0xec 0x00 0x01]
# CHECK-V7: ldc
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x90 0xec 0x00 0x01]
[0x90 0xec 0x00 0x0f]
# CHECK-V7: ldc
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x90 0xec 0x00 0x0f]
[0x90 0xfc 0x00 0x01]
# CHECK-V7: ldc2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x90 0xfc 0x00 0x01]
[0x90 0xfc 0x00 0x0e]
# CHECK-V7: ldc2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x90 0xfc 0x00 0x0e]
[0x90 0xfc 0x00 0x0f]
# CHECK-V7: ldc2
# CHECK: invalid instruction encoding
# CHECK-NEXT: [0x90 0xfc 0x00 0x0f]

View File

@ -3,3 +3,38 @@
# CHECK: sevl.w
0x50 0xbf
0xaf 0xf3 0x05 0x80
# These are the only coprocessor instructions that remain defined in ARMv8
# (The operations on p10/p11 disassemble into FP/NEON instructions)
0x00 0xee 0x10 0x0e
# CHECK: mcr p14
0x00 0xee 0x10 0x0f
# CHECK: mcr p15
0x10 0xee 0x10 0x0e
# CHECK: mrc p14
0x10 0xee 0x10 0x0f
# CHECK: mrc p15
0x40 0xec 0x00 0x0e
# CHECK: mcrr p14
0x40 0xec 0x00 0x0f
# CHECK: mcrr p15
0x50 0xec 0x00 0x0e
# CHECK: mrrc p14
0x50 0xec 0x00 0x0f
# CHECK: mrrc p15
0x80 0xec 0x00 0x0e
# CHECK: stc p14
0x90 0xec 0x00 0x0e
# CHECK: ldc p14