82 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 62; RUN: opt < %s -passes=instcombine -S | FileCheck %s3 4define void @test_poison(float %b, ptr %p) {5; CHECK-LABEL: define void @test_poison(6; CHECK-SAME: float [[B:%.*]], ptr [[P:%.*]]) {7; CHECK-NEXT: [[TMP1:%.*]] = load <8 x float>, ptr [[P]], align 328; CHECK-NEXT: [[TMP2:%.*]] = fptosi float [[B]] to i329; CHECK-NEXT: [[TMP3:%.*]] = add i32 [[TMP2]], -210; CHECK-NEXT: [[TMP4:%.*]] = extractelement <8 x float> [[TMP1]], i32 [[TMP3]]11; CHECK-NEXT: [[TMP5:%.*]] = fptosi float [[TMP4]] to i3212; CHECK-NEXT: [[TMP6:%.*]] = insertelement <8 x i32> poison, i32 [[TMP5]], i64 713; CHECK-NEXT: [[TMP7:%.*]] = sitofp <8 x i32> [[TMP6]] to <8 x float>14; CHECK-NEXT: store <8 x float> [[TMP7]], ptr [[P]], align 3215; CHECK-NEXT: ret void16;17 %1 = load <8 x float>, ptr %p18 %2 = bitcast <8 x float> %1 to <8 x i32>19 %3 = bitcast <8 x i32> %2 to <8 x float>20 %a = fptosi <8 x float> %3 to <8 x i32>21 %4 = fptosi float %b to i3222 %5 = add i32 %4, -223 %6 = extractelement <8 x i32> %a, i32 %524 %7 = insertelement <8 x i32> poison, i32 %6, i32 725 %8 = sitofp <8 x i32> %7 to <8 x float>26 store <8 x float> %8, ptr %p27 ret void28}29 30; PR1860031define i32 @test_bitcast(i32 %i) {32; CHECK-LABEL: define i32 @test_bitcast(33; CHECK-SAME: i32 [[I:%.*]]) {34; CHECK-NEXT: [[E:%.*]] = extractelement <4 x i32> <i32 1, i32 0, i32 2, i32 0>, i32 [[I]]35; CHECK-NEXT: ret i32 [[E]]36;37 %e = extractelement <4 x i32> bitcast (<2 x i64> <i64 1, i64 2> to <4 x i32>), i32 %i38 ret i32 %e39}40 41declare void @use(i32)42 43define void @test_loop(<4 x float> %in) {44; CHECK-LABEL: define void @test_loop(45; CHECK-SAME: <4 x float> [[IN:%.*]]) {46; CHECK-NEXT: [[ENTRY:.*]]:47; CHECK-NEXT: [[R:%.*]] = call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> [[IN]], i32 9)48; CHECK-NEXT: br label %[[LOOP:.*]]49; CHECK: [[LOOP]]:50; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, %[[ENTRY]] ], [ [[NEXT:%.*]], %[[LATCH:.*]] ]51; CHECK-NEXT: [[COND:%.*]] = icmp samesign ult i32 [[I]], 452; CHECK-NEXT: br i1 [[COND]], label %[[BODY:.*]], label %[[DONE:.*]]53; CHECK: [[BODY]]:54; CHECK-NEXT: [[TMP0:%.*]] = extractelement <4 x float> [[R]], i32 [[I]]55; CHECK-NEXT: [[ELEM:%.*]] = fptosi float [[TMP0]] to i3256; CHECK-NEXT: call void @use(i32 [[ELEM]])57; CHECK-NEXT: br label %[[LATCH]]58; CHECK: [[LATCH]]:59; CHECK-NEXT: [[NEXT]] = add nuw nsw i32 [[I]], 160; CHECK-NEXT: br label %[[LOOP]]61; CHECK: [[DONE]]:62; CHECK-NEXT: ret void63;64entry:65 %r = call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> %in, i32 9)66 %vi = fptosi <4 x float> %r to <4 x i32>67 br label %loop68loop:69 %i = phi i32 [ 0, %entry ], [ %next, %latch ]70 %cond = icmp ult i32 %i, 471 br i1 %cond, label %body, label %done72body:73 %elem = extractelement <4 x i32> %vi, i32 %i74 call void @use(i32 %elem)75 br label %latch76latch:77 %next = add i32 %i, 178 br label %loop79done:80 ret void81}82