diff options
author | Duncan Sands <baldrick@free.fr> | 2012-07-05 09:34:15 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2012-07-05 09:34:15 +0000 |
commit | 695b3c24f9c89871655f05c4a4ed69edd2b9606e (patch) | |
tree | 68fbef39a08c0eec1abec66de0a3f97db738926b /LLVMSource | |
parent | 200c66e0db1a9c642dd5eec7ae3562d4ed94c1d9 (diff) |
Generic test for comparisons of vectors with casts. Patch by James Benton.
git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@159740 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'LLVMSource')
-rw-r--r-- | LLVMSource/sext-setcc-self.ll | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/LLVMSource/sext-setcc-self.ll b/LLVMSource/sext-setcc-self.ll new file mode 100644 index 00000000..4e4ad33d --- /dev/null +++ b/LLVMSource/sext-setcc-self.ll @@ -0,0 +1,67 @@ +define <4 x i32> @test_ueq(<4 x float> %val) { +entry: + %cmp = fcmp ueq <4 x float> %val, %val + %mask = sext <4 x i1> %cmp to <4 x i32> + ret <4 x i32> %mask +} + +define <4 x i32> @test_uge(<4 x float> %val) { +entry: + %cmp = fcmp uge <4 x float> %val, %val + %mask = sext <4 x i1> %cmp to <4 x i32> + ret <4 x i32> %mask +} + +define <4 x i32> @test_ule(<4 x float> %val) { +entry: + %cmp = fcmp ule <4 x float> %val, %val + %mask = sext <4 x i1> %cmp to <4 x i32> + ret <4 x i32> %mask +} + +define <4 x i32> @test_one(<4 x float> %val) { +entry: + %cmp = fcmp one <4 x float> %val, %val + %mask = sext <4 x i1> %cmp to <4 x i32> + ret <4 x i32> %mask +} + +define <4 x i32> @test_ogt(<4 x float> %val) { +entry: + %cmp = fcmp ogt <4 x float> %val, %val + %mask = sext <4 x i1> %cmp to <4 x i32> + ret <4 x i32> %mask +} + +define <4 x i32> @test_olt(<4 x float> %val) { +entry: + %cmp = fcmp olt <4 x float> %val, %val + %mask = sext <4 x i1> %cmp to <4 x i32> + ret <4 x i32> %mask +} + +define i32 @main() nounwind { + ; test unordered equality comparisons (all ones) + %res_ueq = call <4 x i32> @test_ueq(<4 x float> undef) + %res_uge = call <4 x i32> @test_uge(<4 x float> undef) + %res_ule = call <4 x i32> @test_ule(<4 x float> undef) + + ; test ordered inequality comparisons (all zeros) + %res_one = call <4 x i32> @test_one(<4 x float> undef) + %res_ogt = call <4 x i32> @test_ogt(<4 x float> undef) + %res_olt = call <4 x i32> @test_olt(<4 x float> undef) + + ; combine all results into a single mask (all ones) + %tmp_uno = and <4 x i32> %res_uge, %res_ule + %res_uno = and <4 x i32> %res_ueq, %tmp_uno + %tmp_ord = or <4 x i32> %res_ogt, %res_olt + %res_ord = or <4 x i32> %res_one, %tmp_ord + %res_ord_inv = xor <4 x i32> %res_ord, <i32 -1, i32 -1, i32 -1, i32 -1> + %res = and <4 x i32> %res_uno, %res_ord_inv + + ; compare result to -1,-1,-1,-1 + %res_scalar = bitcast <4 x i32> %res to i128 + %ret_cmp = icmp ne i128 %res_scalar, -1 + %ret_val = zext i1 %ret_cmp to i32 + ret i32 %ret_val +} |