llvm.org GIT mirror llvm / 67c906d
Fix for PR1613: added 64-bit rotate left PPC instructions and patterns. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41711 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 12 years ago
2 changed file(s) with 30 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
337337 }
338338
339339 // Rotate instructions.
340 def RLDCL : MDForm_1<30, 0,
341 (outs G8RC:$rA), (ins G8RC:$rS, GPRC:$rB, u6imm:$MB),
342 "rldcl $rA, $rS, $rB, $MB", IntRotateD,
343 []>, isPPC64;
340344 def RLDICL : MDForm_1<30, 0,
341345 (outs G8RC:$rA), (ins G8RC:$rS, u6imm:$SH, u6imm:$MB),
342346 "rldicl $rA, $rS, $SH, $MB", IntRotateD,
578582 def : Pat<(srl G8RC:$in, (i32 imm:$imm)),
579583 (RLDICL G8RC:$in, (SRL64 imm:$imm), imm:$imm)>;
580584
585 // ROTL
586 def : Pat<(rotl G8RC:$in, GPRC:$sh),
587 (RLDCL G8RC:$in, GPRC:$sh, 0)>;
588 def : Pat<(rotl G8RC:$in, (i32 imm:$imm)),
589 (RLDICL G8RC:$in, imm:$imm, 0)>;
590
581591 // Hi and Lo for Darwin Global Addresses.
582592 def : Pat<(PPChi tglobaladdr:$in, 0), (LIS8 tglobaladdr:$in)>;
583593 def : Pat<(PPClo tglobaladdr:$in, 0), (LI8 tglobaladdr:$in)>;
0 ; RUN: llvm-as < %s | llc -march=ppc64 | grep rldicl
1 ; RUN: llvm-as < %s | llc -march=ppc64 | grep rldcl
2 ; PR1613
3
4 define i64 @t1(i64 %A) {
5 %tmp1 = lshr i64 %A, 57
6 %tmp2 = shl i64 %A, 7
7 %tmp3 = or i64 %tmp1, %tmp2
8 ret i64 %tmp3
9 }
10
11 define i64 @t2(i64 %A, i8 zeroext %Amt) {
12 %Amt1 = zext i8 %Amt to i64
13 %tmp1 = lshr i64 %A, %Amt1
14 %Amt2 = sub i8 64, %Amt
15 %Amt3 = zext i8 %Amt2 to i64
16 %tmp2 = shl i64 %A, %Amt3
17 %tmp3 = or i64 %tmp1, %tmp2
18 ret i64 %tmp3
19 }