Fix generic shift expansion when shift amount is 0
[oota-llvm.git] / test / CodeGen / X86 / shift-i256.ll
1 ; RUN: llc < %s -march=x86        | FileCheck %s
2 ; RUN: llc < %s -march=x86-64 -O0 | FileCheck %s -check-prefix=CHECK-X64
3 ; RUN: llc < %s -march=x86-64 -O2 | FileCheck %s -check-prefix=CHECK-X64
4
5 ; CHECK-LABEL: shift1
6 define void @shift1(i256 %x, i256 %a, i256* nocapture %r) nounwind readnone {
7 entry:
8         %0 = ashr i256 %x, %a
9         store i256 %0, i256* %r
10         ret void
11 }
12
13 ; CHECK-LABEL: shift2
14 define i256 @shift2(i256 %c) nounwind
15 {
16   %b = shl i256 1, %c  ; %c must not be a constant
17   ; Special case when %c is 0:
18   ; CHECK-X64: testb [[REG:%r[0-9]+b]], [[REG]]
19   ; CHECK-X64: cmoveq
20   ret i256 %b
21 }