1 ; RUN: llc -verify-machineinstrs -mcpu=pwr8 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s -mtriple=ppc64-- | FileCheck %s -check-prefixes=PWR8-CHECK,CHECK
2 ; RUN: llc -verify-machineinstrs -mcpu=pwr9 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s -mtriple=ppc64le-- | FileCheck %s -check-prefixes=PWR9-CHECK,CHECK
4 define i32 @test1(i32 %a) {
5 %tmp.1 = mul nsw i32 %a, 16 ; <i32> [#uses=1]
10 ; CHECK: slwi r[[REG1:[0-9]+]], r3, 4
12 define i32 @test2(i32 %a) {
13 %tmp.1 = mul nsw i32 %a, 17 ; <i32> [#uses=1]
18 ; CHECK: slwi r[[REG1:[0-9]+]], r3, 4
19 ; CHECK-NEXT: add r[[REG2:[0-9]+]], r3, r[[REG1]]
21 define i32 @test3(i32 %a) {
22 %tmp.1 = mul nsw i32 %a, 15 ; <i32> [#uses=1]
27 ; CHECK: slwi r[[REG1:[0-9]+]], r3, 4
28 ; CHECK-NEXT: subf r[[REG2:[0-9]+]], r3, r[[REG1]]
32 define i32 @test4(i32 %a) {
33 %tmp.1 = mul nsw i32 %a, -16 ; <i32> [#uses=1]
38 ; CHECK: slwi r[[REG1:[0-9]+]], r3, 4
39 ; CHECK-NEXT: neg r[[REG2:[0-9]+]], r[[REG1]]
41 define i32 @test5(i32 %a) {
42 %tmp.1 = mul nsw i32 %a, -17 ; <i32> [#uses=1]
46 ; PWR9-CHECK: mulli r[[REG1:[0-9]+]], r3, -17
48 ; PWR8-CHECK: slwi r[[REG1:[0-9]+]], r3, 4
49 ; PWR8-CHECK-NEXT: add r[[REG2:[0-9]+]], r3, r[[REG1]]
50 ; PWR8-CHECK-NEXT: neg r{{[0-9]+}}, r[[REG2]]
52 define i32 @test6(i32 %a) {
53 %tmp.1 = mul nsw i32 %a, -15 ; <i32> [#uses=1]
58 ; CHECK: slwi r[[REG1:[0-9]+]], r3, 4
59 ; CHECK-NEXT: subf r[[REG2:[0-9]+]], r[[REG1]], r3
64 define i32 @test7(i32 %a) {
65 %tmp.1 = mul nsw i32 %a, -2147483648 ; <i32> [#uses=1]
70 ; CHECK: slwi r[[REG1:[0-9]+]], r3, 31
72 define i32 @test8(i32 %a) {
73 %tmp.1 = mul nsw i32 %a, 2147483647 ; <i32> [#uses=1]
78 ; CHECK: slwi r[[REG1:[0-9]+]], r3, 31
79 ; CHECK-NEXT: subf r[[REG2:[0-9]+]], r3, r[[REG1]]