[llvm] r322072 - [InstCombine] Add pow2 mul -> shl tests for vectors with uniform/non-uniform constants
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 9 03:55:27 PST 2018
Author: rksimon
Date: Tue Jan 9 03:55:27 2018
New Revision: 322072
URL: http://llvm.org/viewvc/llvm-project?rev=322072&view=rev
Log:
[InstCombine] Add pow2 mul -> shl tests for vectors with uniform/non-uniform constants
Modified:
llvm/trunk/test/Transforms/InstCombine/apint-mul1.ll
llvm/trunk/test/Transforms/InstCombine/apint-mul2.ll
Modified: llvm/trunk/test/Transforms/InstCombine/apint-mul1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/apint-mul1.ll?rev=322072&r1=322071&r2=322072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/apint-mul1.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/apint-mul1.ll Tue Jan 9 03:55:27 2018
@@ -1,11 +1,32 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
; This test makes sure that mul instructions are properly eliminated.
; This test is for Integer BitWidth < 64 && BitWidth % 2 != 0.
-;
-; RUN: opt < %s -instcombine -S | not grep mul
+define i17 @test1(i17 %X) {
+; CHECK-LABEL: @test1(
+; CHECK-NEXT: [[Y:%.*]] = shl i17 [[X:%.*]], 10
+; CHECK-NEXT: ret i17 [[Y]]
+;
+ %Y = mul i17 %X, 1024
+ ret i17 %Y
+}
+define <2 x i17> @test2(<2 x i17> %X) {
+; CHECK-LABEL: @test2(
+; CHECK-NEXT: [[Y:%.*]] = shl <2 x i17> [[X:%.*]], <i17 10, i17 10>
+; CHECK-NEXT: ret <2 x i17> [[Y]]
+;
+ %Y = mul <2 x i17> %X, <i17 1024, i17 1024>
+ ret <2 x i17> %Y
+}
-define i17 @test1(i17 %X) {
- %Y = mul i17 %X, 1024
- ret i17 %Y
-}
+define <2 x i17> @test3(<2 x i17> %X) {
+; CHECK-LABEL: @test3(
+; CHECK-NEXT: [[Y:%.*]] = mul <2 x i17> [[X:%.*]], <i17 1024, i17 256>
+; CHECK-NEXT: ret <2 x i17> [[Y]]
+;
+ %Y = mul <2 x i17> %X, <i17 1024, i17 256>
+ ret <2 x i17> %Y
+}
Modified: llvm/trunk/test/Transforms/InstCombine/apint-mul2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/apint-mul2.ll?rev=322072&r1=322071&r2=322072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/apint-mul2.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/apint-mul2.ll Tue Jan 9 03:55:27 2018
@@ -1,12 +1,35 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
; This test makes sure that mul instructions are properly eliminated.
; This test is for Integer BitWidth >= 64 && BitWidth % 2 >= 1024.
-;
-; RUN: opt < %s -instcombine -S | not grep mul
+define i177 @test1(i177 %X) {
+; CHECK-LABEL: @test1(
+; CHECK-NEXT: [[Y:%.*]] = shl i177 [[X:%.*]], 155
+; CHECK-NEXT: ret i177 [[Y]]
+;
+ %C = shl i177 1, 155
+ %Y = mul i177 %X, %C
+ ret i177 %Y
+}
+define <2 x i177> @test2(<2 x i177> %X) {
+; CHECK-LABEL: @test2(
+; CHECK-NEXT: [[Y:%.*]] = shl <2 x i177> [[X:%.*]], <i177 155, i177 155>
+; CHECK-NEXT: ret <2 x i177> [[Y]]
+;
+ %C = shl <2 x i177> <i177 1, i177 1>, <i177 155, i177 155>
+ %Y = mul <2 x i177> %X, %C
+ ret <2 x i177> %Y
+}
-define i177 @test1(i177 %X) {
- %C = shl i177 1, 155
- %Y = mul i177 %X, %C
- ret i177 %Y
-}
+define <2 x i177> @test3(<2 x i177> %X) {
+; CHECK-LABEL: @test3(
+; CHECK-NEXT: [[Y:%.*]] = mul <2 x i177> [[X:%.*]], <i177 1427247692705959881058285969449495136382746624, i177 45671926166590716193865151022383844364247891968>
+; CHECK-NEXT: ret <2 x i177> [[Y]]
+;
+ %C = shl <2 x i177> <i177 1, i177 1>, <i177 150, i177 155>
+ %Y = mul <2 x i177> %X, %C
+ ret <2 x i177> %Y
+}
More information about the llvm-commits
mailing list