[llvm-commits] [test-suite] r159740 - /test-suite/trunk/LLVMSource/sext-setcc-self.ll
Duncan Sands
baldrick at free.fr
Thu Jul 5 02:34:15 PDT 2012
Author: baldrick
Date: Thu Jul 5 04:34:15 2012
New Revision: 159740
URL: http://llvm.org/viewvc/llvm-project?rev=159740&view=rev
Log:
Generic test for comparisons of vectors with casts. Patch by James Benton.
Added:
test-suite/trunk/LLVMSource/sext-setcc-self.ll
Added: test-suite/trunk/LLVMSource/sext-setcc-self.ll
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/LLVMSource/sext-setcc-self.ll?rev=159740&view=auto
==============================================================================
--- test-suite/trunk/LLVMSource/sext-setcc-self.ll (added)
+++ test-suite/trunk/LLVMSource/sext-setcc-self.ll Thu Jul 5 04:34:15 2012
@@ -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
+}
More information about the llvm-commits
mailing list