1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -verify-machineinstrs < %s -mtriple=ppc32-- | FileCheck %s 3 4define i32 @rotl32(i32 %A, i8 %Amt) nounwind { 5; CHECK-LABEL: rotl32: 6; CHECK: # %bb.0: 7; CHECK-NEXT: rotlw 3, 3, 4 8; CHECK-NEXT: blr 9 %shift.upgrd.1 = zext i8 %Amt to i32 ; <i32> [#uses=1] 10 %B = shl i32 %A, %shift.upgrd.1 ; <i32> [#uses=1] 11 %Amt2 = sub i8 32, %Amt ; <i8> [#uses=1] 12 %shift.upgrd.2 = zext i8 %Amt2 to i32 ; <i32> [#uses=1] 13 %C = lshr i32 %A, %shift.upgrd.2 ; <i32> [#uses=1] 14 %D = or i32 %B, %C ; <i32> [#uses=1] 15 ret i32 %D 16} 17 18define i32 @rotr32(i32 %A, i8 %Amt) nounwind { 19; CHECK-LABEL: rotr32: 20; CHECK: # %bb.0: 21; CHECK-NEXT: subfic 4, 4, 32 22; CHECK-NEXT: rotlw 3, 3, 4 23; CHECK-NEXT: blr 24 %shift.upgrd.3 = zext i8 %Amt to i32 ; <i32> [#uses=1] 25 %B = lshr i32 %A, %shift.upgrd.3 ; <i32> [#uses=1] 26 %Amt2 = sub i8 32, %Amt ; <i8> [#uses=1] 27 %shift.upgrd.4 = zext i8 %Amt2 to i32 ; <i32> [#uses=1] 28 %C = shl i32 %A, %shift.upgrd.4 ; <i32> [#uses=1] 29 %D = or i32 %B, %C ; <i32> [#uses=1] 30 ret i32 %D 31} 32 33define i32 @rotli32(i32 %A) nounwind { 34; CHECK-LABEL: rotli32: 35; CHECK: # %bb.0: 36; CHECK-NEXT: rotlwi 3, 3, 5 37; CHECK-NEXT: blr 38 %B = shl i32 %A, 5 ; <i32> [#uses=1] 39 %C = lshr i32 %A, 27 ; <i32> [#uses=1] 40 %D = or i32 %B, %C ; <i32> [#uses=1] 41 ret i32 %D 42} 43 44define i32 @rotri32(i32 %A) nounwind { 45; CHECK-LABEL: rotri32: 46; CHECK: # %bb.0: 47; CHECK-NEXT: rotlwi 3, 3, 27 48; CHECK-NEXT: blr 49 %B = lshr i32 %A, 5 ; <i32> [#uses=1] 50 %C = shl i32 %A, 27 ; <i32> [#uses=1] 51 %D = or i32 %B, %C ; <i32> [#uses=1] 52 ret i32 %D 53} 54 55