129 lines · plain
1; RUN: opt < %s -codegenprepare -S -mtriple=x86_64-unknown-unknown | FileCheck %s2 3 4@a = global [10 x i8] zeroinitializer, align 15declare void @foo()6 7; ext(and(ld, cst)) -> and(ext(ld), ext(cst))8define void @test1(ptr %p, i32 %ll) {9; CHECK-LABEL: @test110; CHECK-NEXT: entry:11; CHECK-NEXT: load12; CHECK-NEXT: zext13; CHECK-NEXT: and14entry:15 %tmp = load i8, ptr @a, align 116 %and = and i8 %tmp, 6017 %cmp = icmp ugt i8 %and, 2018 br i1 %cmp, label %if.then, label %if.end19 20if.then: ; preds = %entry21 %conv2 = zext i8 %and to i3222 %add = add nsw i32 %conv2, %ll23 store i32 %add, ptr %p, align 424 br label %if.end25 26if.end: ; preds = %if.then, %entry27 tail call void @foo()28 ret void29}30 31; ext(or(ld, cst)) -> or(ext(ld), ext(cst))32define void @test2(ptr %p, i32 %ll) {33; CHECK-LABEL: @test234; CHECK-NEXT: entry:35; CHECK-NEXT: load36; CHECK-NEXT: zext37; CHECK-NEXT: or38entry:39 %tmp = load i8, ptr @a, align 140 %or = or i8 %tmp, 6041 %cmp = icmp ugt i8 %or, 2042 br i1 %cmp, label %if.then, label %if.end43 44if.then: ; preds = %entry45 %conv2 = zext i8 %or to i3246 %add = add nsw i32 %conv2, %ll47 store i32 %add, ptr %p, align 448 br label %if.end49 50if.end: ; preds = %if.then, %entry51 tail call void @foo()52 ret void53}54 55; ext(and(shl(ld, cst), cst)) -> and(shl(ext(ld), ext(cst)), ext(cst))56define void @test3(ptr %p, i32 %ll) {57; CHECK-LABEL: @test358; CHECK-NEXT: entry:59; CHECK-NEXT: load60; CHECK-NEXT: zext61; CHECK-NEXT: shl62; CHECK-NEXT: and63entry:64 %tmp = load i8, ptr @a, align 165 %shl = shl i8 %tmp, 266 %and = and i8 %shl, 6067 %cmp = icmp ugt i8 %and, 2068 br i1 %cmp, label %if.then, label %if.end69 70if.then: ; preds = %entry71 %conv2 = zext i8 %and to i3272 %add = add nsw i32 %conv2, %ll73 store i32 %add, ptr %p, align 474 br label %if.end75 76if.end: ; preds = %if.then, %entry77 tail call void @foo()78 ret void79}80 81; zext(shrl(ld, cst)) -> shrl(zext(ld), zext(cst))82define void @test4(ptr %p, i32 %ll) {83; CHECK-LABEL: @test484; CHECK-NEXT: entry:85; CHECK-NEXT: load86; CHECK-NEXT: zext87; CHECK-NEXT: lshr88entry:89 %tmp = load i8, ptr @a, align 190 %lshr = lshr i8 %tmp, 291 %cmp = icmp ugt i8 %lshr, 2092 br i1 %cmp, label %if.then, label %if.end93 94if.then: ; preds = %entry95 %conv2 = zext i8 %lshr to i3296 %add = add nsw i32 %conv2, %ll97 store i32 %add, ptr %p, align 498 br label %if.end99 100if.end: ; preds = %if.then, %entry101 tail call void @foo()102 ret void103}104 105; ext(xor(ld, cst)) -> xor(ext(ld), ext(cst))106define void @test5(ptr %p, i32 %ll) {107; CHECK-LABEL: @test5108; CHECK-NEXT: entry:109; CHECK-NEXT: load110; CHECK-NEXT: zext111; CHECK-NEXT: xor112entry:113 %tmp = load i8, ptr @a, align 1114 %xor = xor i8 %tmp, 60115 %cmp = icmp ugt i8 %xor, 20116 br i1 %cmp, label %if.then, label %if.end117 118if.then: ; preds = %entry119 %conv2 = zext i8 %xor to i32120 %add = add nsw i32 %conv2, %ll121 store i32 %add, ptr %p, align 4122 br label %if.end123 124if.end: ; preds = %if.then, %entry125 tail call void @foo()126 ret void127}128 129