1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[ARM] ARM mov InstAlias for MOVW lacks HasV6T2

The movw instruction is only available in ARM state for V6T2 and above.
The MOVi16 instruction has requirement HasV6T2 but the InstAlias
for mov rd, imm where the operand is imm0_65535_expr:$imm does not.

This means that movw can incorrectly be used in ARMv4 and ARMv5 by
writing mov rd, 0x1234. The simple fix is to the requirement HasV6T2
to the InstAlias. Tests added to not-armv4.s.

Patch by Peter Smith.

llvm-svn: 269761
This commit is contained in:
Renato Golin 2016-05-17 13:05:28 +00:00
parent 874333eb48
commit 5e4f70ea56
2 changed files with 6 additions and 1 deletions

View File

@ -3334,7 +3334,7 @@ def MOVi16 : AI1<0b1000, (outs GPR:$Rd), (ins imm0_65535_expr:$imm),
def : InstAlias<"mov${p} $Rd, $imm",
(MOVi16 GPR:$Rd, imm0_65535_expr:$imm, pred:$p)>,
Requires<[IsARM]>;
Requires<[IsARM, HasV6T2]>;
def MOVi16_ga_pcrel : PseudoInst<(outs GPR:$Rd),
(ins i32imm:$addr, pclabel:$id), IIC_iMOVi, []>,

View File

@ -6,3 +6,8 @@ clz r4,r9
@ CHECK: error: instruction requires: armv6t2
rbit r4,r9
@ CHECK: error: instruction requires: armv6t2
movw r4,#0x1234
@ CHECK: error: instruction requires: armv6t2
mov r4,#0x1234