[llvm] r270284 - add test for vector shift

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri May 20 15:08:17 PDT 2016


Author: spatel
Date: Fri May 20 17:08:16 2016
New Revision: 270284

URL: http://llvm.org/viewvc/llvm-project?rev=270284&view=rev
Log:
add test for vector shift

Modified:
    llvm/trunk/test/Transforms/InstCombine/shift.ll

Modified: llvm/trunk/test/Transforms/InstCombine/shift.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/shift.ll?rev=270284&r1=270283&r2=270284&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/shift.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/shift.ll Fri May 20 17:08:16 2016
@@ -700,6 +700,19 @@ define i32 @test42(i32 %a, i32 %b) nounw
   ret i32 %div2
 }
 
+; FIXME: Vector lshr should be treated the same as scalar. 
+
+define <2 x i32> @test42vec(<2 x i32> %a, <2 x i32> %b) {
+; CHECK-LABEL: @test42vec(
+; CHECK-NEXT:    [[DIV:%.*]] = lshr <2 x i32> <i32 4096, i32 4096>, %b
+; CHECK-NEXT:    [[DIV2:%.*]] = udiv <2 x i32> %a, [[DIV]]
+; CHECK-NEXT:    ret <2 x i32> [[DIV2]]
+;
+  %div = lshr <2 x i32> <i32 4096, i32 4096>, %b    ; must be exact otherwise we'd divide by zero
+  %div2 = udiv <2 x i32> %a, %div
+  ret <2 x i32> %div2
+}
+
 define i32 @test43(i32 %a, i32 %b) nounwind {
 ; CHECK-LABEL: @test43(
 ; CHECK-NEXT:    [[TMP1:%.*]] = add i32 %b, 12




More information about the llvm-commits mailing list