mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-07 19:47:53 +00:00
8a77617721
Summary: This patch fixes an issue so that the right alias is printed when the instruction has tied operands. It checks the number of operands in the resulting instruction as opposed to the alias, and then skips over tied operands that should not be printed in the alias. This allows to generate the preferred assembly syntax for the AArch64 'ins' instruction, which should always be displayed as 'mov' according to the ARM Architecture Reference Manual. Several unit tests have changed as a result, but only to reflect the preferred disassembly. Some other InstAlias patterns (movk/bic/orr) needed a slight adjustment to stop them becoming the default and breaking other unit tests. Please note that the patch is mostly the same as https://reviews.llvm.org/D29219 which was reverted because of an issue found when running TableGen with the Address Sanitizer. That issue has been addressed in this iteration of the patch. Reviewers: rengolin, stoklund, huntergr, SjoerdMeijer, rovka Reviewed By: rengolin, SjoerdMeijer Subscribers: fhahn, aemerson, javed.absar, kristof.beyls, llvm-commits Differential Revision: https://reviews.llvm.org/D40030 llvm-svn: 318650
62 lines
1.8 KiB
LLVM
62 lines
1.8 KiB
LLVM
; RUN: llc -mtriple=aarch64-eabi %s -o - | FileCheck %s
|
|
|
|
; These tests just check that the plumbing is in place for @llvm.bitreverse.
|
|
|
|
declare <2 x i16> @llvm.bitreverse.v2i16(<2 x i16>) readnone
|
|
|
|
define <2 x i16> @f(<2 x i16> %a) {
|
|
; CHECK-LABEL: f:
|
|
; CHECK: fmov [[REG1:w[0-9]+]], s0
|
|
; CHECK-DAG: rbit [[REG2:w[0-9]+]], [[REG1]]
|
|
; CHECK-DAG: fmov s0, [[REG2]]
|
|
; CHECK-DAG: mov [[REG3:w[0-9]+]], v0.s[1]
|
|
; CHECK-DAG: rbit [[REG4:w[0-9]+]], [[REG3]]
|
|
; CHECK-DAG: mov v0.s[1], [[REG4]]
|
|
; CHECK-DAG: ushr v0.2s, v0.2s, #16
|
|
%b = call <2 x i16> @llvm.bitreverse.v2i16(<2 x i16> %a)
|
|
ret <2 x i16> %b
|
|
}
|
|
|
|
declare i8 @llvm.bitreverse.i8(i8) readnone
|
|
|
|
define i8 @g(i8 %a) {
|
|
; CHECK-LABEL: g:
|
|
; CHECK: rbit [[REG:w[0-9]+]], w0
|
|
; CHECK-NEXT: lsr w0, [[REG]], #24
|
|
; CHECK-NEXT: ret
|
|
%b = call i8 @llvm.bitreverse.i8(i8 %a)
|
|
ret i8 %b
|
|
}
|
|
|
|
declare <8 x i8> @llvm.bitreverse.v8i8(<8 x i8>) readnone
|
|
|
|
define <8 x i8> @g_vec(<8 x i8> %a) {
|
|
; CHECK-DAG: movi [[M1:v.*]], #15
|
|
; CHECK-DAG: movi [[M2:v.*]], #240
|
|
; CHECK: and [[A1:v.*]], v0.8b, [[M1]]
|
|
; CHECK: and [[A2:v.*]], v0.8b, [[M2]]
|
|
; CHECK-DAG: shl [[L4:v.*]], [[A1]], #4
|
|
; CHECK-DAG: ushr [[R4:v.*]], [[A2]], #4
|
|
; CHECK-DAG: orr [[V4:v.*]], [[R4]], [[L4]]
|
|
|
|
; CHECK-DAG: movi [[M3:v.*]], #51
|
|
; CHECK-DAG: movi [[M4:v.*]], #204
|
|
; CHECK: and [[A3:v.*]], [[V4]], [[M3]]
|
|
; CHECK: and [[A4:v.*]], [[V4]], [[M4]]
|
|
; CHECK-DAG: shl [[L2:v.*]], [[A3]], #2
|
|
; CHECK-DAG: ushr [[R2:v.*]], [[A4]], #2
|
|
; CHECK-DAG: orr [[V2:v.*]], [[R2]], [[L2]]
|
|
|
|
; CHECK-DAG: movi [[M5:v.*]], #85
|
|
; CHECK-DAG: movi [[M6:v.*]], #170
|
|
; CHECK: and [[A5:v.*]], [[V2]], [[M5]]
|
|
; CHECK: and [[A6:v.*]], [[V2]], [[M6]]
|
|
; CHECK-DAG: shl [[L1:v.*]], [[A5]], #1
|
|
; CHECK-DAG: ushr [[R1:v.*]], [[A6]], #1
|
|
; CHECK: orr [[V1:v.*]], [[R1]], [[L1]]
|
|
|
|
; CHECK: ret
|
|
%b = call <8 x i8> @llvm.bitreverse.v8i8(<8 x i8> %a)
|
|
ret <8 x i8> %b
|
|
}
|