1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00

[InstCombine] Add pow2 mul -> shl tests for vectors with uniform/non-uniform constants

llvm-svn: 322072
This commit is contained in:
Simon Pilgrim 2018-01-09 11:55:27 +00:00
parent af104b58a6
commit cf96df537b
2 changed files with 59 additions and 15 deletions

View File

@ -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) {
%Y = mul i17 %X, 1024
ret i17 %Y
}
; 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 <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
}

View File

@ -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) {
%C = shl i177 1, 155
%Y = mul i177 %X, %C
ret i177 %Y
}
; 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 <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
}