xref: /llvm-project/llvm/test/Transforms/InstCombine/apint-mul1.ll (revision 38fffa630ee80163dc65e759392ad29798905679)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -passes=instcombine -S | FileCheck %s
3
4; This test makes sure that mul instructions are properly eliminated.
5; This test is for Integer BitWidth < 64 && BitWidth % 2 != 0.
6
7define i17 @test1(i17 %X) {
8; CHECK-LABEL: @test1(
9; CHECK-NEXT:    [[Y:%.*]] = shl i17 [[X:%.*]], 10
10; CHECK-NEXT:    ret i17 [[Y]]
11;
12  %Y = mul i17 %X, 1024
13  ret i17 %Y
14}
15
16define <2 x i17> @test2(<2 x i17> %X) {
17; CHECK-LABEL: @test2(
18; CHECK-NEXT:    [[Y:%.*]] = shl <2 x i17> [[X:%.*]], splat (i17 10)
19; CHECK-NEXT:    ret <2 x i17> [[Y]]
20;
21  %Y = mul <2 x i17> %X, <i17 1024, i17 1024>
22  ret <2 x i17> %Y
23}
24
25define <2 x i17> @test3(<2 x i17> %X) {
26; CHECK-LABEL: @test3(
27; CHECK-NEXT:    [[Y:%.*]] = shl <2 x i17> [[X:%.*]], <i17 10, i17 8>
28; CHECK-NEXT:    ret <2 x i17> [[Y]]
29;
30  %Y = mul <2 x i17> %X, <i17 1024, i17 256>
31  ret <2 x i17> %Y
32}
33