• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -instcombine < %s | FileCheck %s
3
4define void @test_shl(i1 %x) {
5; CHECK-LABEL: @test_shl(
6; CHECK-NEXT:    call void @sink(i8 0)
7; CHECK-NEXT:    ret void
8;
9  %y = zext i1 %x to i8
10  %z = shl i8 64, %y
11  %a = and i8 %z, 1
12  call void @sink(i8 %a)
13  ret void
14}
15
16define void @test_lshr(i1 %x) {
17; CHECK-LABEL: @test_lshr(
18; CHECK-NEXT:    call void @sink(i8 0)
19; CHECK-NEXT:    ret void
20;
21  %y = zext i1 %x to i8
22  %z = lshr i8 64, %y
23  %a = and i8 %z, 1
24  call void @sink(i8 %a)
25  ret void
26}
27
28define void @test_ashr(i1 %x) {
29; CHECK-LABEL: @test_ashr(
30; CHECK-NEXT:    call void @sink(i8 0)
31; CHECK-NEXT:    ret void
32;
33  %y = zext i1 %x to i8
34  %z = ashr i8 -16, %y
35  %a = and i8 %z, 3
36  call void @sink(i8 %a)
37  ret void
38}
39
40define void @test_udiv(i8 %x) {
41; CHECK-LABEL: @test_udiv(
42; CHECK-NEXT:    call void @sink(i8 0)
43; CHECK-NEXT:    ret void
44;
45  %y = udiv i8 10, %x
46  %z = and i8 %y, 64
47  call void @sink(i8 %z)
48  ret void
49}
50
51declare void @sink(i8)
52