std::swap(InL, InH);
// Use a little trick to get the bits that move from Lo to Hi. First
- // calculate the shift with amount-1.
- SDValue Sh1 = DAG.getNode(Op2, dl, NVT, InL, Amt2);
- // Then shift one bit further to get the right result.
- SDValue Sh2 = DAG.getNode(Op2, dl, NVT, Sh1, DAG.getConstant(1, ShTy));
+ // shift by one bit.
+ SDValue Sh1 = DAG.getNode(Op2, dl, NVT, InL, DAG.getConstant(1, ShTy));
+ // Then compute the remaining shift with amount-1.
+ SDValue Sh2 = DAG.getNode(Op2, dl, NVT, Sh1, Amt2);
Lo = DAG.getNode(N->getOpcode(), dl, NVT, InL, Amt);
Hi = DAG.getNode(ISD::OR, dl, NVT, DAG.getNode(Op1, dl, NVT, InH, Amt),Sh2);
ret i64 %shl
; CHECK: test1:
; CHECK: shll %cl, %eax
+; CHECK: shrl %edx
; CHECK: xorb $31
; CHECK: shrl %cl, %edx
-; CHECK: shrl %edx
}
define i64 @test2(i64 %xx, i32 %test) nounwind {
ret i64 %shl
; CHECK: test2:
; CHECK: shll %cl, %esi
+; CHECK: shrl %edx
; CHECK: xorb $31
; CHECK: shrl %cl, %edx
-; CHECK: shrl %edx
; CHECK: orl %esi, %edx
; CHECK: shll %cl, %eax
}
ret i64 %shr
; CHECK: test3:
; CHECK: shrl %cl, %esi
+; CHECK: leal (%edx,%edx), %eax
; CHECK: xorb $31, %cl
; CHECK: shll %cl, %eax
-; CHECK: addl %eax, %eax
; CHECK: orl %esi, %eax
; CHECK: shrl %cl, %edx
}
ret i64 %shr
; CHECK: test4:
; CHECK: shrl %cl, %esi
+; CHECK: leal (%edx,%edx), %eax
; CHECK: xorb $31, %cl
; CHECK: shll %cl, %eax
-; CHECK: addl %eax, %eax
; CHECK: orl %esi, %eax
; CHECK: sarl %cl, %edx
}