1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s
3 ; RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple=powerpc64-ibm-aix-xcoff -vec-extabi < %s | FileCheck %s
5 define i64 @test1(i64 %x) {
8 ; CHECK-NEXT: mulli 3, 3, 625
9 ; CHECK-NEXT: sldi 3, 3, 36
11 %y = mul i64 %x, 42949672960000
15 define i64 @test2(i64 %x) {
18 ; CHECK-NEXT: mulli 3, 3, -625
19 ; CHECK-NEXT: sldi 3, 3, 36
21 %y = mul i64 %x, -42949672960000
25 define i64 @test3(i64 %x) {
28 ; CHECK-NEXT: mulli 3, 3, 297
29 ; CHECK-NEXT: sldi 3, 3, 14
31 %y = mul i64 %x, 4866048
35 define i64 @test4(i64 %x) {
38 ; CHECK-NEXT: mulli 3, 3, -297
39 ; CHECK-NEXT: sldi 3, 3, 14
41 %y = mul i64 %x, -4866048
45 define i64 @test5(i64 %x) {
48 ; CHECK-NEXT: sldi 4, 3, 12
49 ; CHECK-NEXT: sldi 3, 3, 32
50 ; CHECK-NEXT: add 3, 3, 4
52 %y = mul i64 %x, 4294971392
56 define i64 @test6(i64 %x) {
59 ; CHECK-NEXT: sldi 4, 3, 12
60 ; CHECK-NEXT: sldi 3, 3, 32
61 ; CHECK-NEXT: add 3, 3, 4
62 ; CHECK-NEXT: neg 3, 3
64 %y = mul i64 %x, -4294971392
68 define i64 @test7(i64 %x) {
71 ; CHECK-NEXT: sldi 4, 3, 34
72 ; CHECK-NEXT: sldi 3, 3, 13
73 ; CHECK-NEXT: sub 3, 4, 3
75 %y = mul i64 %x, 17179860992
79 define i64 @test8(i64 %x) {
82 ; CHECK-NEXT: sldi 4, 3, 13
83 ; CHECK-NEXT: sldi 3, 3, 34
84 ; CHECK-NEXT: sub 3, 4, 3
86 %y = mul i64 %x, -17179860992
90 define i64 @test9(i64 %x) {
93 ; CHECK-NEXT: sldi 4, 3, 12
94 ; CHECK-NEXT: sldi 5, 3, 32
95 ; CHECK-NEXT: add 4, 5, 4
96 ; CHECK-NEXT: mulli 3, 3, 8193
97 ; CHECK-NEXT: sldi 3, 3, 19
98 ; CHECK-NEXT: sub 3, 4, 3
100 %y = mul i64 %x, 4294971392
101 %z = mul i64 %x, 4295491584
102 %res = sub i64 %y, %z
106 define i64 @test10(i64 %x) {
107 ; CHECK-LABEL: test10:
109 ; CHECK-NEXT: sldi 4, 3, 34
110 ; CHECK-NEXT: sldi 3, 3, 30
111 ; CHECK-NEXT: sub 3, 4, 3
113 %y = mul i64 %x, 17179860992
114 %z = mul i64 %x, 1073733632
115 %res = sub i64 %y, %z
119 define i32 @test11(i32 %x) {
120 ; CHECK-LABEL: test11:
122 ; CHECK-NEXT: mulli 3, 3, 21845
123 ; CHECK-NEXT: slwi 3, 3, 5
125 %y = mul nsw i32 %x, 699040