1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/MC/Disassembler/ARM/thumb2-v8.txt
Diogo Sampaio 69646a28e6 [ARM][Thumb2] Fix ADD/SUB invalid writes to SP
Summary:
This patch fixes pr23772  [ARM] r226200 can emit illegal thumb2 instruction: "sub sp, r12, #80".
The violation was that SUB and ADD (reg, immediate) instructions can only write to SP if the source register is also SP. So the above instructions was unpredictable.
To enforce that the instruction t2(ADD|SUB)ri does not write to SP we now enforce the destination register to be rGPR (That exclude PC and SP).
Different than the ARM specification, that defines one instruction that can read from SP, and one that can't, here we inserted one that can't write to SP, and other that can only write to SP as to reuse most of the hard-coded size optimizations.
When performing this change, it uncovered that emitting Thumb2 Reg plus Immediate could not emit all variants of ADD SP, SP #imm instructions before so it was refactored to be able to. (see test/CodeGen/Thumb2/mve-stacksplot.mir where we use a subw sp, sp, Imm12 variant )
It also uncovered a disassembly issue of adr.w instructions, that were only written as SUBW instructions (see llvm/test/MC/Disassembler/ARM/thumb2.txt).

Reviewers: eli.friedman, dmgreen, carwil, olista01, efriedma, andreadb

Reviewed By: efriedma

Subscribers: gbedwell, john.brawn, efriedma, ostannard, kristof.beyls, hiraditya, dmgreen, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70680
2020-01-14 11:47:19 +00:00

43 lines
703 B
Plaintext

# RUN: llvm-mc -triple=thumbv8 -disassemble < %s | FileCheck %s
# CHECK: sevl
# 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
[0x0f,0xf2,0x00,0x4d]
# CHECK: adr.w sp, #1024