1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -sccp -S < %s | FileCheck %s 3 4target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128" 5 6; rdar://11324230 7 8declare void @use(i1) 9 10define void @foo(<2 x i64>* %p) nounwind { 11; CHECK-LABEL: @foo( 12; CHECK-NEXT: entry: 13; CHECK-NEXT: br label [[WHILE_BODY_I:%.*]] 14; CHECK: while.body.i: 15; CHECK-NEXT: [[VWORKEXPONENT_I_033:%.*]] = phi <4 x i32> [ [[SUB_I_I:%.*]], [[WHILE_BODY_I]] ], [ <i32 939524096, i32 939524096, i32 939524096, i32 939524096>, [[ENTRY:%.*]] ] 16; CHECK-NEXT: [[SUB_I_I]] = add <4 x i32> [[VWORKEXPONENT_I_033]], <i32 -8388608, i32 -8388608, i32 -8388608, i32 -8388608> 17; CHECK-NEXT: [[TMP0:%.*]] = bitcast <4 x i32> [[SUB_I_I]] to <2 x i64> 18; CHECK-NEXT: store volatile <2 x i64> zeroinitializer, <2 x i64>* [[P:%.*]], align 16 19; CHECK-NEXT: br label [[WHILE_BODY_I]] 20; 21entry: 22 br label %while.body.i 23 24while.body.i: ; preds = %while.body.i, %entry 25 %vWorkExponent.i.033 = phi <4 x i32> [ %sub.i.i, %while.body.i ], [ <i32 939524096, i32 939524096, i32 939524096, i32 939524096>, %entry ] 26 %sub.i.i = add <4 x i32> %vWorkExponent.i.033, <i32 -8388608, i32 -8388608, i32 -8388608, i32 -8388608> 27 %0 = bitcast <4 x i32> %sub.i.i to <2 x i64> 28 %and.i119.i = and <2 x i64> %0, zeroinitializer 29 store volatile <2 x i64> %and.i119.i, <2 x i64>* %p 30 br label %while.body.i 31} 32 33%union.V512 = type { <16 x float> } 34 35@i8_mix = dso_local global %union.V512 zeroinitializer 36declare <64 x i8> @llvm.abs.v64i8(<64 x i8>, i1 immarg) 37 38; Test for PR47991. 39define void @vec_cast_abs() { 40; CHECK-LABEL: @vec_cast_abs( 41; CHECK-NEXT: entry: 42; CHECK-NEXT: [[TMP1:%.*]] = load <64 x i8>, <64 x i8>* bitcast (%union.V512* @i8_mix to <64 x i8>*), align 64 43; CHECK-NEXT: [[TMP2:%.*]] = tail call <64 x i8> @llvm.abs.v64i8(<64 x i8> [[TMP1]], i1 false) 44; CHECK-NEXT: [[TMP3:%.*]] = bitcast <64 x i8> [[TMP2]] to i512 45; CHECK-NEXT: [[CMP_1:%.*]] = icmp eq i512 [[TMP3]], 12 46; CHECK-NEXT: call void @use(i1 [[CMP_1]]) 47; CHECK-NEXT: [[CMP_2:%.*]] = icmp ult i512 [[TMP3]], 500 48; CHECK-NEXT: call void @use(i1 [[CMP_2]]) 49; CHECK-NEXT: [[TMP4:%.*]] = trunc i512 [[TMP3]] to i32 50; CHECK-NEXT: [[CMP_3:%.*]] = icmp eq i32 [[TMP4]], 12 51; CHECK-NEXT: call void @use(i1 [[CMP_3]]) 52; CHECK-NEXT: [[CMP_4:%.*]] = icmp ult i32 [[TMP4]], 500 53; CHECK-NEXT: call void @use(i1 [[CMP_3]]) 54; CHECK-NEXT: ret void 55; 56entry: 57 %tmp1 = load <64 x i8>, <64 x i8>* bitcast (%union.V512* @i8_mix to <64 x i8>*) 58 %tmp2 = tail call <64 x i8> @llvm.abs.v64i8(<64 x i8> %tmp1, i1 false) 59 60 %tmp3 = bitcast <64 x i8> %tmp2 to i512 61 %cmp.1 = icmp eq i512 %tmp3, 12 62 call void @use(i1 %cmp.1) 63 %cmp.2 = icmp ult i512 %tmp3, 500 64 call void @use(i1 %cmp.2) 65 66 %tmp4 = trunc i512 %tmp3 to i32 67 %cmp.3 = icmp eq i32 %tmp4, 12 68 call void @use(i1 %cmp.3) 69 %cmp.4 = icmp ult i32 %tmp4, 500 70 call void @use(i1 %cmp.3) 71 72 ret void 73} 74