1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ;RUN: llc < %s | FileCheck %s
4 ; This test case failed on legalization of "shl" node. PR29058.
6 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
7 target triple = "x86_64-unknown-linux-gnu"
9 @structMember = external dso_local local_unnamed_addr global i64, align 8
11 define i32 @PR29058(i8 %x, i32 %y) {
12 ; CHECK-LABEL: PR29058:
13 ; CHECK: # %bb.0: # %entry
14 ; CHECK-NEXT: testb %dil, %dil
15 ; CHECK-NEXT: movl $2147483646, %eax # imm = 0x7FFFFFFE
16 ; CHECK-NEXT: cmovnel %esi, %eax
17 ; CHECK-NEXT: xorl %ecx, %ecx
18 ; CHECK-NEXT: cmpb $1, %dil
19 ; CHECK-NEXT: sbbl %ecx, %ecx
20 ; CHECK-NEXT: orb %sil, %cl
21 ; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
22 ; CHECK-NEXT: shll %cl, %eax
23 ; CHECK-NEXT: movq %rax, structMember(%rip)
24 ; CHECK-NEXT: # kill: def $eax killed $eax killed $rax
27 %bool_1 = icmp ne i8 %x, 0
28 %bool_2 = icmp eq i8 %x, 0
29 %0 = select i1 %bool_2, i32 2147483646, i32 %y
30 %or_1 = select i1 %bool_1, i32 %y, i32 -1
31 %shl_1 = shl i32 %0, %or_1
32 %conv = zext i32 %shl_1 to i64
33 store i64 %conv, ptr @structMember, align 8
34 %tmp = select i1 %bool_2, i32 2147483646, i32 %y
35 %lnot = icmp eq i8 %x, 0
36 %or_2 = select i1 %lnot, i32 -1, i32 %y
37 %shl_2 = shl i32 %tmp, %or_2