• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=lanai < %s | FileCheck %s
2
3; Test the in place lowering of mul i32.
4
5define i32 @f6(i32 inreg %a) #0 {
6entry:
7  %mul = mul nsw i32 %a, 6
8  ret i32 %mul
9}
10; CHECK: sh %r6, 0x1, %r{{[0-9]+}}
11; CHECK: sh %r6, 0x3, %r{{[0-9]+}}
12; CHECK: sub %r{{[0-9]+}}, %r{{[0-9]+}}, %rv
13
14define i32 @f7(i32 inreg %a) #0 {
15entry:
16  %mul = mul nsw i32 %a, 7
17  ret i32 %mul
18}
19; CHECK: sh %r6, 0x3, %r{{[0-9]+}}
20; CHECK: sub %r{{[0-9]+}}, %r6, %rv
21
22define i32 @f8(i32 inreg %a) #0 {
23entry:
24  %mul = shl nsw i32 %a, 3
25  ret i32 %mul
26}
27; CHECK: sh %r6, 0x3, %rv
28
29define i32 @fm6(i32 inreg %a) #0 {
30entry:
31  %mul = mul nsw i32 %a, -6
32  ret i32 %mul
33}
34; CHECK: sh %r6, 0x3, %r{{[0-9]+}}
35; CHECK: sh %r6, 0x1, %r{{[0-9]+}}
36; CHECK: sub %r{{[0-9]+}}, %r{{[0-9]+}}, %rv
37
38define i32 @fm7(i32 inreg %a) #0 {
39entry:
40  %mul = mul nsw i32 %a, -7
41  ret i32 %mul
42}
43; CHECK: sh %r6, 0x3, %r{{[0-9]+}}
44; CHECK: sub %r6, %r{{[0-9]+}}, %rv
45
46define i32 @fm8(i32 inreg %a) #0 {
47entry:
48  %mul = mul nsw i32 %a, -8
49  ret i32 %mul
50}
51; CHECK: sh %r6, 0x3, %r{{[0-9]+}}
52; CHECK: sub %r{{[0-9]+}}, %r{{[0-9]+}}, %rv
53
54define i32 @h1(i32 inreg %a) #0 {
55entry:
56  %mul = mul i32 %a, -1431655765
57  ret i32 %mul
58}
59; CHECK: h1
60; CHECK: mulsi3
61