1; RUN: llc < %s -march=x86-64 | FileCheck %s 2; PR5039 3 4define i32 @test1(i32 %x) nounwind { 5 %and = shl i32 %x, 10 6 %shl = and i32 %and, 31744 7 ret i32 %shl 8; CHECK-LABEL: test1: 9; CHECK: andl $31 10; CHECK: shll $10 11} 12 13define i32 @test2(i32 %x) nounwind { 14 %or = shl i32 %x, 10 15 %shl = or i32 %or, 31744 16 ret i32 %shl 17; CHECK-LABEL: test2: 18; CHECK: orl $31 19; CHECK: shll $10 20} 21 22define i32 @test3(i32 %x) nounwind { 23 %xor = shl i32 %x, 10 24 %shl = xor i32 %xor, 31744 25 ret i32 %shl 26; CHECK-LABEL: test3: 27; CHECK: xorl $31 28; CHECK: shll $10 29} 30 31define i64 @test4(i64 %x) nounwind { 32 %and = shl i64 %x, 40 33 %shl = and i64 %and, 264982302294016 34 ret i64 %shl 35; CHECK-LABEL: test4: 36; CHECK: andq $241 37; CHECK: shlq $40 38} 39 40define i64 @test5(i64 %x) nounwind { 41 %and = shl i64 %x, 40 42 %shl = and i64 %and, 34084860461056 43 ret i64 %shl 44; CHECK-LABEL: test5: 45; CHECK: andq $31 46; CHECK: shlq $40 47} 48 49define i64 @test6(i64 %x) nounwind { 50 %and = shl i64 %x, 32 51 %shl = and i64 %and, -281474976710656 52 ret i64 %shl 53; CHECK-LABEL: test6: 54; CHECK: andq $-65536 55; CHECK: shlq $32 56} 57 58define i64 @test7(i64 %x) nounwind { 59 %or = shl i64 %x, 40 60 %shl = or i64 %or, 264982302294016 61 ret i64 %shl 62; CHECK-LABEL: test7: 63; CHECK: orq $241 64; CHECK: shlq $40 65} 66 67define i64 @test8(i64 %x) nounwind { 68 %or = shl i64 %x, 40 69 %shl = or i64 %or, 34084860461056 70 ret i64 %shl 71; CHECK-LABEL: test8: 72; CHECK: orq $31 73; CHECK: shlq $40 74} 75 76define i64 @test9(i64 %x) nounwind { 77 %xor = shl i64 %x, 40 78 %shl = xor i64 %xor, 264982302294016 79 ret i64 %shl 80; CHECK-LABEL: test9: 81; CHECK: orq $241 82; CHECK: shlq $40 83} 84 85define i64 @test10(i64 %x) nounwind { 86 %xor = shl i64 %x, 40 87 %shl = xor i64 %xor, 34084860461056 88 ret i64 %shl 89; CHECK-LABEL: test10: 90; CHECK: xorq $31 91; CHECK: shlq $40 92} 93 94define i64 @test11(i64 %x) nounwind { 95 %xor = shl i64 %x, 33 96 %shl = xor i64 %xor, -562949953421312 97 ret i64 %shl 98; CHECK-LABEL: test11: 99; CHECK: xorq $-65536 100; CHECK: shlq $33 101} 102 103; PR23098 104define i32 @test12(i32 %x, i32* %y) nounwind { 105 %and = shl i32 %x, 1 106 %shl = and i32 %and, 255 107 store i32 %shl, i32* %y 108 ret i32 %shl 109; CHECK-LABEL: test12: 110; CHECK: andl $127 111; CHECK-NEXT: addl 112; CHECK-NOT: shl 113} 114 115define i64 @test13(i64 %x, i64* %y) nounwind { 116 %and = shl i64 %x, 1 117 %shl = and i64 %and, 255 118 store i64 %shl, i64* %y 119 ret i64 %shl 120; CHECK-LABEL: test13: 121; CHECK: andq $127 122; CHECK-NEXT: addq 123; CHECK-NOT: shl 124} 125