mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
be488ff93c
Follow up to D101357 / 3fa6510f6. Supersedes D102330. Goal: Use flags setting rdffrs instead of rdffr + ptest. Problem: RDFFR_P doesn't have have a flags setting equivalent. Solution: in instcombine, canonicalize to RDFFR_PP at the IR level, and rely on RDFFR_PP+PTEST => RDFFRS_PP optimization in AArch64InstrInfo::optimizePTestInstr. While here: * Test that rdffr.z+ptest generates a rdffrs. * Use update_{test,llc}_checks.py on the tests. * Use sve attribute on functions. Differential Revision: https://reviews.llvm.org/D102623
74 lines
1.9 KiB
LLVM
74 lines
1.9 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc < %s | FileCheck %s
|
|
|
|
target triple = "aarch64-unknown-linux-gnu"
|
|
|
|
;
|
|
; RDFFR
|
|
;
|
|
|
|
define <vscale x 16 x i1> @rdffr() #0 {
|
|
; CHECK-LABEL: rdffr:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: rdffr p0.b
|
|
; CHECK-NEXT: ret
|
|
%out = call <vscale x 16 x i1> @llvm.aarch64.sve.rdffr()
|
|
ret <vscale x 16 x i1> %out
|
|
}
|
|
|
|
define <vscale x 16 x i1> @rdffr_z(<vscale x 16 x i1> %pg) #0 {
|
|
; CHECK-LABEL: rdffr_z:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: rdffr p0.b, p0/z
|
|
; CHECK-NEXT: ret
|
|
%out = call <vscale x 16 x i1> @llvm.aarch64.sve.rdffr.z(<vscale x 16 x i1> %pg)
|
|
ret <vscale x 16 x i1> %out
|
|
}
|
|
|
|
; Test that rdffr.z followed by ptest optimizes to flags-setting rdffrs.
|
|
define i1 @rdffr_z_ptest(<vscale x 16 x i1> %pg) #0 {
|
|
; CHECK-LABEL: rdffr_z_ptest:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: rdffrs p0.b, p0/z
|
|
; CHECK-NEXT: cset w0, ne
|
|
; CHECK-NEXT: ret
|
|
%rdffr = call <vscale x 16 x i1> @llvm.aarch64.sve.rdffr.z(<vscale x 16 x i1> %pg)
|
|
%out = call i1 @llvm.aarch64.sve.ptest.any.nxv16i1(<vscale x 16 x i1> %pg, <vscale x 16 x i1> %rdffr)
|
|
ret i1 %out
|
|
}
|
|
|
|
;
|
|
; SETFFR
|
|
;
|
|
|
|
define void @set_ffr() #0 {
|
|
; CHECK-LABEL: set_ffr:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: setffr
|
|
; CHECK-NEXT: ret
|
|
call void @llvm.aarch64.sve.setffr()
|
|
ret void
|
|
}
|
|
|
|
;
|
|
; WRFFR
|
|
;
|
|
|
|
define void @wrffr(<vscale x 16 x i1> %a) #0 {
|
|
; CHECK-LABEL: wrffr:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: wrffr p0.b
|
|
; CHECK-NEXT: ret
|
|
call void @llvm.aarch64.sve.wrffr(<vscale x 16 x i1> %a)
|
|
ret void
|
|
}
|
|
|
|
declare <vscale x 16 x i1> @llvm.aarch64.sve.rdffr()
|
|
declare <vscale x 16 x i1> @llvm.aarch64.sve.rdffr.z(<vscale x 16 x i1>)
|
|
declare void @llvm.aarch64.sve.setffr()
|
|
declare void @llvm.aarch64.sve.wrffr(<vscale x 16 x i1>)
|
|
|
|
declare i1 @llvm.aarch64.sve.ptest.any.nxv16i1(<vscale x 16 x i1>, <vscale x 16 x i1>)
|
|
|
|
attributes #0 = { "target-features"="+sve" }
|