mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[ConstantFolding] Add tests for sat add/sub with undefs; NFC
llvm-svn: 349802
This commit is contained in:
parent
ca92d63931
commit
0ace13fe01
@ -170,3 +170,221 @@ define <2 x i8> @test_ssub_vector_sat_neg(<2 x i8> %a) {
|
||||
%x = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> <i8 -100, i8 -10>, <2 x i8> <i8 30, i8 120>)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
||||
; Tests for undef handling
|
||||
|
||||
define i8 @test_uadd_scalar_both_undef() {
|
||||
; CHECK-LABEL: @test_uadd_scalar_both_undef(
|
||||
; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.uadd.sat.i8(i8 undef, i8 undef)
|
||||
; CHECK-NEXT: ret i8 [[X]]
|
||||
;
|
||||
%x = call i8 @llvm.uadd.sat.i8(i8 undef, i8 undef)
|
||||
ret i8 %x
|
||||
}
|
||||
|
||||
define i8 @test_sadd_scalar_both_undef() {
|
||||
; CHECK-LABEL: @test_sadd_scalar_both_undef(
|
||||
; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.sadd.sat.i8(i8 undef, i8 undef)
|
||||
; CHECK-NEXT: ret i8 [[X]]
|
||||
;
|
||||
%x = call i8 @llvm.sadd.sat.i8(i8 undef, i8 undef)
|
||||
ret i8 %x
|
||||
}
|
||||
|
||||
define i8 @test_usub_scalar_both_undef() {
|
||||
; CHECK-LABEL: @test_usub_scalar_both_undef(
|
||||
; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.usub.sat.i8(i8 undef, i8 undef)
|
||||
; CHECK-NEXT: ret i8 [[X]]
|
||||
;
|
||||
%x = call i8 @llvm.usub.sat.i8(i8 undef, i8 undef)
|
||||
ret i8 %x
|
||||
}
|
||||
|
||||
define i8 @test_ssub_scalar_both_undef() {
|
||||
; CHECK-LABEL: @test_ssub_scalar_both_undef(
|
||||
; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.ssub.sat.i8(i8 undef, i8 undef)
|
||||
; CHECK-NEXT: ret i8 [[X]]
|
||||
;
|
||||
%x = call i8 @llvm.ssub.sat.i8(i8 undef, i8 undef)
|
||||
ret i8 %x
|
||||
}
|
||||
|
||||
define i8 @test_uadd_scalar_op2_undef() {
|
||||
; CHECK-LABEL: @test_uadd_scalar_op2_undef(
|
||||
; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.uadd.sat.i8(i8 10, i8 undef)
|
||||
; CHECK-NEXT: ret i8 [[X]]
|
||||
;
|
||||
%x = call i8 @llvm.uadd.sat.i8(i8 10, i8 undef)
|
||||
ret i8 %x
|
||||
}
|
||||
|
||||
define i8 @test_sadd_scalar_op1_undef() {
|
||||
; CHECK-LABEL: @test_sadd_scalar_op1_undef(
|
||||
; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.sadd.sat.i8(i8 undef, i8 10)
|
||||
; CHECK-NEXT: ret i8 [[X]]
|
||||
;
|
||||
%x = call i8 @llvm.sadd.sat.i8(i8 undef, i8 10)
|
||||
ret i8 %x
|
||||
}
|
||||
|
||||
define i8 @test_usub_scalar_op2_undef() {
|
||||
; CHECK-LABEL: @test_usub_scalar_op2_undef(
|
||||
; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.usub.sat.i8(i8 10, i8 undef)
|
||||
; CHECK-NEXT: ret i8 [[X]]
|
||||
;
|
||||
%x = call i8 @llvm.usub.sat.i8(i8 10, i8 undef)
|
||||
ret i8 %x
|
||||
}
|
||||
|
||||
define i8 @test_usub_scalar_op1_undef() {
|
||||
; CHECK-LABEL: @test_usub_scalar_op1_undef(
|
||||
; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.usub.sat.i8(i8 undef, i8 10)
|
||||
; CHECK-NEXT: ret i8 [[X]]
|
||||
;
|
||||
%x = call i8 @llvm.usub.sat.i8(i8 undef, i8 10)
|
||||
ret i8 %x
|
||||
}
|
||||
|
||||
define <2 x i8> @test_uadd_vector_both_undef_splat() {
|
||||
; CHECK-LABEL: @test_uadd_vector_both_undef_splat(
|
||||
; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> undef, <2 x i8> undef)
|
||||
; CHECK-NEXT: ret <2 x i8> [[X]]
|
||||
;
|
||||
%x = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> undef, <2 x i8> undef)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
||||
define <2 x i8> @test_sadd_vector_both_undef_splat() {
|
||||
; CHECK-LABEL: @test_sadd_vector_both_undef_splat(
|
||||
; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> undef, <2 x i8> undef)
|
||||
; CHECK-NEXT: ret <2 x i8> [[X]]
|
||||
;
|
||||
%x = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> undef, <2 x i8> undef)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
||||
define <2 x i8> @test_usub_vector_both_undef_splat() {
|
||||
; CHECK-LABEL: @test_usub_vector_both_undef_splat(
|
||||
; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> undef, <2 x i8> undef)
|
||||
; CHECK-NEXT: ret <2 x i8> [[X]]
|
||||
;
|
||||
%x = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> undef, <2 x i8> undef)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
||||
define <2 x i8> @test_ssub_vector_both_undef_splat() {
|
||||
; CHECK-LABEL: @test_ssub_vector_both_undef_splat(
|
||||
; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> undef, <2 x i8> undef)
|
||||
; CHECK-NEXT: ret <2 x i8> [[X]]
|
||||
;
|
||||
%x = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> undef, <2 x i8> undef)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
||||
define <2 x i8> @test_uadd_vector_op2_undef_splat() {
|
||||
; CHECK-LABEL: @test_uadd_vector_op2_undef_splat(
|
||||
; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> <i8 10, i8 20>, <2 x i8> undef)
|
||||
; CHECK-NEXT: ret <2 x i8> [[X]]
|
||||
;
|
||||
%x = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> <i8 10, i8 20>, <2 x i8> undef)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
||||
define <2 x i8> @test_sadd_vector_op1_undef_splat() {
|
||||
; CHECK-LABEL: @test_sadd_vector_op1_undef_splat(
|
||||
; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> undef, <2 x i8> <i8 10, i8 20>)
|
||||
; CHECK-NEXT: ret <2 x i8> [[X]]
|
||||
;
|
||||
%x = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> undef, <2 x i8> <i8 10, i8 20>)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
||||
define <2 x i8> @test_usub_vector_op2_undef_splat() {
|
||||
; CHECK-LABEL: @test_usub_vector_op2_undef_splat(
|
||||
; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> <i8 10, i8 20>, <2 x i8> undef)
|
||||
; CHECK-NEXT: ret <2 x i8> [[X]]
|
||||
;
|
||||
%x = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> <i8 10, i8 20>, <2 x i8> undef)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
||||
define <2 x i8> @test_ssub_vector_op1_undef_splat() {
|
||||
; CHECK-LABEL: @test_ssub_vector_op1_undef_splat(
|
||||
; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> undef, <2 x i8> <i8 10, i8 20>)
|
||||
; CHECK-NEXT: ret <2 x i8> [[X]]
|
||||
;
|
||||
%x = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> undef, <2 x i8> <i8 10, i8 20>)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
||||
define <2 x i8> @test_uadd_vector_op2_undef_mix1() {
|
||||
; CHECK-LABEL: @test_uadd_vector_op2_undef_mix1(
|
||||
; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 20, i8 undef>)
|
||||
; CHECK-NEXT: ret <2 x i8> [[X]]
|
||||
;
|
||||
%x = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 20, i8 undef>)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
||||
define <2 x i8> @test_uadd_vector_op2_undef_mix2() {
|
||||
; CHECK-LABEL: @test_uadd_vector_op2_undef_mix2(
|
||||
; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 undef, i8 20>)
|
||||
; CHECK-NEXT: ret <2 x i8> [[X]]
|
||||
;
|
||||
%x = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 undef, i8 20>)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
||||
define <2 x i8> @test_sadd_vector_op1_undef_mix1() {
|
||||
; CHECK-LABEL: @test_sadd_vector_op1_undef_mix1(
|
||||
; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 undef, i8 20>)
|
||||
; CHECK-NEXT: ret <2 x i8> [[X]]
|
||||
;
|
||||
%x = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 undef, i8 20>)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
||||
define <2 x i8> @test_sadd_vector_op1_undef_mix2() {
|
||||
; CHECK-LABEL: @test_sadd_vector_op1_undef_mix2(
|
||||
; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 20, i8 undef>)
|
||||
; CHECK-NEXT: ret <2 x i8> [[X]]
|
||||
;
|
||||
%x = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 20, i8 undef>)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
||||
define <2 x i8> @test_usub_vector_op2_undef_mix1() {
|
||||
; CHECK-LABEL: @test_usub_vector_op2_undef_mix1(
|
||||
; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 20, i8 undef>)
|
||||
; CHECK-NEXT: ret <2 x i8> [[X]]
|
||||
;
|
||||
%x = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 20, i8 undef>)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
||||
define <2 x i8> @test_usub_vector_op2_undef_mix2() {
|
||||
; CHECK-LABEL: @test_usub_vector_op2_undef_mix2(
|
||||
; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 undef, i8 20>)
|
||||
; CHECK-NEXT: ret <2 x i8> [[X]]
|
||||
;
|
||||
%x = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 undef, i8 20>)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
||||
define <2 x i8> @test_ssub_vector_op1_undef_mix1() {
|
||||
; CHECK-LABEL: @test_ssub_vector_op1_undef_mix1(
|
||||
; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 undef, i8 20>)
|
||||
; CHECK-NEXT: ret <2 x i8> [[X]]
|
||||
;
|
||||
%x = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 undef, i8 20>)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
||||
define <2 x i8> @test_ssub_vector_op1_undef_mix2() {
|
||||
; CHECK-LABEL: @test_ssub_vector_op1_undef_mix2(
|
||||
; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 20, i8 undef>)
|
||||
; CHECK-NEXT: ret <2 x i8> [[X]]
|
||||
;
|
||||
%x = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 20, i8 undef>)
|
||||
ret <2 x i8> %x
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user