1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-24 21:42:54 +02:00
llvm-mirror/test/CodeGen/ARM/sat-arith.ll
Asiri Rathnayake 8d48a252a1 Fix mapping of @llvm.arm.ssat/usat intrinsics to ssat/usat instructions
The mapping of these two intrinsics in ARMInstrInfo.td had a small
omission which lead to their operands not being validated/transformed
before being lowered into usat and ssat instructions. This can cause
incorrect instructions to be emitted.

I've also added tests for the remaining two saturating arithmatic
intrinsics @llvm.arm.qadd and @llvm.arm.qsub as they are missing
codegen tests.

llvm-svn: 250697
2015-10-19 11:44:24 +00:00

61 lines
1.6 KiB
LLVM

; RUN: llc -O1 -mtriple=armv6-none-none-eabi %s -o - | FileCheck %s
; CHECK-LABEL: qadd
define i32 @qadd() nounwind {
; CHECK: mov [[R0:.*]], #8
; CHECK: mov [[R1:.*]], #128
; CHECK: qadd [[R0]], [[R1]], [[R0]]
%tmp = call i32 @llvm.arm.qadd(i32 128, i32 8)
ret i32 %tmp
}
; CHECK-LABEL: qsub
define i32 @qsub() nounwind {
; CHECK: mov [[R0:.*]], #8
; CHECK: mov [[R1:.*]], #128
; CHECK: qsub [[R0]], [[R1]], [[R0]]
%tmp = call i32 @llvm.arm.qsub(i32 128, i32 8)
ret i32 %tmp
}
; upper-bound of the immediate argument
; CHECK-LABEL: ssat1
define i32 @ssat1() nounwind {
; CHECK: mov [[R0:.*]], #128
; CHECK: ssat [[R1:.*]], #32, [[R0]]
%tmp = call i32 @llvm.arm.ssat(i32 128, i32 32)
ret i32 %tmp
}
; lower-bound of the immediate argument
; CHECK-LABEL: ssat2
define i32 @ssat2() nounwind {
; CHECK: mov [[R0:.*]], #128
; CHECK: ssat [[R1:.*]], #1, [[R0]]
%tmp = call i32 @llvm.arm.ssat(i32 128, i32 1)
ret i32 %tmp
}
; upper-bound of the immediate argument
; CHECK-LABEL: usat1
define i32 @usat1() nounwind {
; CHECK: mov [[R0:.*]], #128
; CHECK: usat [[R1:.*]], #31, [[R0]]
%tmp = call i32 @llvm.arm.usat(i32 128, i32 31)
ret i32 %tmp
}
; lower-bound of the immediate argument
; CHECK-LABEL: usat2
define i32 @usat2() nounwind {
; CHECK: mov [[R0:.*]], #128
; CHECK: usat [[R1:.*]], #0, [[R0]]
%tmp = call i32 @llvm.arm.usat(i32 128, i32 0)
ret i32 %tmp
}
declare i32 @llvm.arm.qadd(i32, i32) nounwind
declare i32 @llvm.arm.qsub(i32, i32) nounwind
declare i32 @llvm.arm.ssat(i32, i32) nounwind readnone
declare i32 @llvm.arm.usat(i32, i32) nounwind readnone