1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -mtriple=r600-- -passes=amdgpu-printf-runtime-binding -mcpu=r600 -S < %s | FileCheck --check-prefix=R600 %s 3; RUN: opt -mtriple=amdgcn-- -passes=amdgpu-printf-runtime-binding -mcpu=fiji -S < %s | FileCheck --check-prefix=GCN %s 4; RUN: opt -mtriple=amdgcn--amdhsa -passes=amdgpu-printf-runtime-binding -mcpu=fiji -S < %s | FileCheck --check-prefix=GCN %s 5 6@.str = private unnamed_addr addrspace(4) constant [6 x i8] c"%s:%d\00", align 1 7 8@format.str.no.null.terminator = private unnamed_addr addrspace(4) constant [10 x i8] c"abcdefg %d", align 1 9@indexed.format.str = private unnamed_addr addrspace(4) constant [11 x i8] c"abcdefg %d\00", align 1 10 11 12@printed.str.size0 = private addrspace(4) constant [0 x i8] zeroinitializer, align 1 13@printed.str.1ai8.zero = private addrspace(4) constant [1 x i8] zeroinitializer, align 1 14@printed.str.1ai8.undef = private addrspace(4) constant [1 x i8] undef, align 1 15@printed.str.i8.zero = private addrspace(4) constant i8 0, align 1 16@printed.str.size2 = private addrspace(4) constant [2 x i8] [i8 27, i8 0], align 1 17@printed.str.size3 = private addrspace(4) constant [3 x i8] [i8 27, i8 28, i8 0], align 1 18@printed.str.size3.zero = private addrspace(4) constant [3 x i8] zeroinitializer, align 1 19@printed.str.size4 = private addrspace(4) constant [4 x i8] c"abc\00", align 1 20@printed.str.size4.nonull.term = private addrspace(4) constant [4 x i8] c"abcd", align 1 21@printed.str.size5 = private addrspace(4) constant [5 x i8] c"abcd\00", align 1 22@printed.str.size6 = private addrspace(4) constant [6 x i8] c"abcde\00", align 1 23@printed.str.size7 = private addrspace(4) constant [7 x i8] c"abcdefg", align 1 24@printed.str.size8 = private addrspace(4) constant [8 x i8] c"arstars\00", align 1 25@printed.str.size9 = private addrspace(4) constant [9 x i8] c"deadbeef\00", align 1 26@printed.str.size16 = private addrspace(4) constant [16 x i8] c"161616161616161\00", align 1 27@printed.str.size17 = private addrspace(4) constant [17 x i8] c"1717171717171717\00", align 1 28@printed.str.size20 = private addrspace(4) constant [20 x i8] c"abcdefghijklmnopqrs\00", align 1 29@printed.str.size32 = private addrspace(4) constant [32 x i8] c"arstarstarstarstarstarstarstars\00", align 1 30@printed.str.not.constant.size4 = private addrspace(4) global [4 x i8] c"abc\00", align 1 31@printed.str.interposable.size4 = weak addrspace(4) constant [4 x i8] c"qrs\00", align 1 32 33@printed.str.v4i8 = private addrspace(4) constant <4 x i8> <i8 1, i8 2, i8 3, i8 4>, align 4 34@printed.str.v4i32 = private addrspace(4) constant <4 x i32> <i32 1, i32 2, i32 3, i32 4>, align 4 35@printed.str.struct = private addrspace(4) constant { i32, i32, i32 } {i32 66, i32 77, i32 88 }, align 4 36@printed.str.float.neg0 = private addrspace(4) constant float -0.0, align 4 37@printed.str.float.0 = private addrspace(4) constant float 0.0, align 4 38@printed.str.ptr.null = private addrspace(4) constant ptr null, align 4 39@printed.str.ptr.undef = private addrspace(4) constant ptr undef, align 4 40@format.str.f = private unnamed_addr addrspace(4) constant [33 x i8] c"%f %f %f %f %f %f %f %f %f %f %f\00", align 1 41@format.str.p = private unnamed_addr addrspace(4) constant [15 x i8] c"%p %p %p %p %p\00", align 1 42@format.str.d = private unnamed_addr addrspace(4) constant [30 x i8] c"%d %d %d %d %d %d %d %d %d %d\00", align 1 43 44@format.str.v1 = private unnamed_addr addrspace(4) constant [35 x i8] c"%v1f %v1f %v1d %v1d %v1p %v1p %v1f\00", align 1 45@format.str.v2 = private unnamed_addr addrspace(4) constant [35 x i8] c"%v2f %v2f %v2d %v2d %v2p %v2p %v2f\00", align 1 46@format.str.v3 = private unnamed_addr addrspace(4) constant [35 x i8] c"%v3f %v3f %v3d %v3d %v3p %v3p %v3f\00", align 1 47@format.str.v4 = private unnamed_addr addrspace(4) constant [35 x i8] c"%v4f %v4f %v4d %v4d %v4p %v4p %v4f\00", align 1 48@format.str.v8 = private unnamed_addr addrspace(4) constant [35 x i8] c"%v8f %v8f %v8d %v8d %v8p %v8p %v8f\00", align 1 49@format.str.v16 = private unnamed_addr addrspace(4) constant [42 x i8] c"%v16f %v16f %v16d %v16d %v16p %v16p %v16f\00", align 1 50@format.str.u = private unnamed_addr addrspace(4) constant [30 x i8] c"%u %u %u %u %u %u %u %u %u %u\00", align 1 51@format.str.one.ptr = private unnamed_addr addrspace(4) constant [8 x i8] c"arst %p\00", align 1 52 53 54define amdgpu_kernel void @format_str_f(float %f32.0, double %f64, float %f32.1, i16 %i16, i32 %i32, i64 %i64, half %f16) { 55; R600-LABEL: @format_str_f( 56; R600-NEXT: [[FPEXT_F32_TO_F64:%.*]] = fpext float [[F32_1:%.*]] to double 57; R600-NEXT: [[CALL1:%.*]] = call i32 @printf(ptr addrspace(4) @format.str.f, float [[F32_0:%.*]], double [[F64:%.*]], double [[FPEXT_F32_TO_F64]], float 1.000000e+00, double 2.000000e+00, i16 [[I16:%.*]], i32 [[I32:%.*]], i64 [[I64:%.*]], <2 x float> <float 1.000000e+00, float 2.000000e+00>, <2 x i32> <i32 8, i32 234>, half [[F16:%.*]]) 58; R600-NEXT: ret void 59; 60; GCN-LABEL: @format_str_f( 61; GCN-NEXT: [[FPEXT_F32_TO_F64:%.*]] = fpext float [[F32_1:%.*]] to double 62; GCN-NEXT: [[TMP1:%.*]] = sext i16 [[I16:%.*]] to i32 63; GCN-NEXT: [[TMP2:%.*]] = bitcast half [[F16:%.*]] to i16 64; GCN-NEXT: [[TMP3:%.*]] = sext i16 [[TMP2]] to i32 65; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 64) 66; GCN-NEXT: br label [[DOTSPLIT:%.*]] 67; GCN: .split: 68; GCN-NEXT: [[TMP4:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 69; GCN-NEXT: br i1 [[TMP4]], label [[TMP5:%.*]], label [[TMP6:%.*]] 70; GCN: 5: 71; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 72; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 73; GCN-NEXT: store i32 1, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 74; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 75; GCN-NEXT: store float [[F32_0:%.*]], ptr addrspace(1) [[PRINTBUFFGEP]], align 4 76; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 77; GCN-NEXT: store double [[F64:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 8 78; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 8 79; GCN-NEXT: store float [[F32_1]], ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 4 80; GCN-NEXT: [[PRINTBUFFNEXTPTR2:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], i32 4 81; GCN-NEXT: store float 1.000000e+00, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], align 4 82; GCN-NEXT: [[PRINTBUFFNEXTPTR3:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], i32 4 83; GCN-NEXT: store float 2.000000e+00, ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], align 4 84; GCN-NEXT: [[PRINTBUFFNEXTPTR4:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], i32 4 85; GCN-NEXT: store i32 [[TMP1]], ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], align 4 86; GCN-NEXT: [[PRINTBUFFNEXTPTR5:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], i32 4 87; GCN-NEXT: store i32 [[I32:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], align 4 88; GCN-NEXT: [[PRINTBUFFNEXTPTR6:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], i32 4 89; GCN-NEXT: store i64 [[I64:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR6]], align 8 90; GCN-NEXT: [[PRINTBUFFNEXTPTR7:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR6]], i32 8 91; GCN-NEXT: store <2 x float> <float 1.000000e+00, float 2.000000e+00>, ptr addrspace(1) [[PRINTBUFFNEXTPTR7]], align 8 92; GCN-NEXT: [[PRINTBUFFNEXTPTR8:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR7]], i32 8 93; GCN-NEXT: store <2 x i32> <i32 8, i32 234>, ptr addrspace(1) [[PRINTBUFFNEXTPTR8]], align 8 94; GCN-NEXT: [[PRINTBUFFNEXTPTR9:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR8]], i32 8 95; GCN-NEXT: store i32 [[TMP3]], ptr addrspace(1) [[PRINTBUFFNEXTPTR9]], align 4 96; GCN-NEXT: br label [[TMP6]] 97; GCN: 6: 98; GCN-NEXT: ret void 99; 100 %fpext.f32.to.f64 = fpext float %f32.1 to double 101 %call1 = call i32 @printf(ptr addrspace(4) @format.str.f, float %f32.0, double %f64, double %fpext.f32.to.f64, float 1.0, double 2.0, i16 %i16, i32 %i32, i64 %i64, <2 x float> <float 1.0, float 2.0>, <2 x i32> <i32 8, i32 234>, half %f16) 102 ret void 103} 104 105define void @format_str_ptr(ptr %ptr.flat, ptr addrspace(3) %ptr.lds, ptr addrspace(1) %ptr.global, ptr addrspace(5) %ptr.stack, ptr addrspace(4) %ptr.const) { 106; R600-LABEL: @format_str_ptr( 107; R600-NEXT: [[CALL:%.*]] = call i32 @printf(ptr addrspace(4) @format.str.p, ptr [[PTR_FLAT:%.*]], ptr addrspace(3) [[PTR_LDS:%.*]], ptr addrspace(1) [[PTR_GLOBAL:%.*]], ptr addrspace(5) [[PTR_STACK:%.*]], ptr addrspace(4) [[PTR_CONST:%.*]]) 108; R600-NEXT: ret void 109; 110; GCN-LABEL: @format_str_ptr( 111; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 36) 112; GCN-NEXT: br label [[DOTSPLIT:%.*]] 113; GCN: .split: 114; GCN-NEXT: [[TMP1:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 115; GCN-NEXT: br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP3:%.*]] 116; GCN: 2: 117; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 118; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 119; GCN-NEXT: store i32 2, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 120; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 121; GCN-NEXT: store ptr [[PTR_FLAT:%.*]], ptr addrspace(1) [[PRINTBUFFGEP]], align 8 122; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 8 123; GCN-NEXT: store ptr addrspace(3) [[PTR_LDS:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 124; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 4 125; GCN-NEXT: store ptr addrspace(1) [[PTR_GLOBAL:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 8 126; GCN-NEXT: [[PRINTBUFFNEXTPTR2:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], i32 8 127; GCN-NEXT: store ptr addrspace(5) [[PTR_STACK:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], align 4 128; GCN-NEXT: [[PRINTBUFFNEXTPTR3:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], i32 4 129; GCN-NEXT: store ptr addrspace(4) [[PTR_CONST:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], align 8 130; GCN-NEXT: br label [[TMP3]] 131; GCN: 3: 132; GCN-NEXT: ret void 133; 134 %call = call i32 @printf(ptr addrspace(4) @format.str.p, ptr %ptr.flat, ptr addrspace(3) %ptr.lds, ptr addrspace(1) %ptr.global, ptr addrspace(5) %ptr.stack, ptr addrspace(4) %ptr.const) 135 ret void 136} 137 138define amdgpu_kernel void @format_str_d(i1 %i1, i4 %i4, i8 %i8, i24 %i24, i16 %i16, i32 %i32, i64 %i64, i96 %i96, i128 %i128) { 139; R600-LABEL: @format_str_d( 140; R600-NEXT: [[CALL:%.*]] = call i32 @printf(ptr addrspace(4) @format.str.d, i1 [[I1:%.*]], i4 [[I4:%.*]], i8 [[I8:%.*]], i24 [[I24:%.*]], i16 [[I16:%.*]], i32 [[I32:%.*]], i64 [[I64:%.*]], i96 [[I96:%.*]], i128 [[I128:%.*]], i32 1234) 141; R600-NEXT: ret void 142; 143; GCN-LABEL: @format_str_d( 144; GCN-NEXT: [[TMP1:%.*]] = sext i1 [[I1:%.*]] to i32 145; GCN-NEXT: [[TMP2:%.*]] = sext i4 [[I4:%.*]] to i32 146; GCN-NEXT: [[TMP3:%.*]] = sext i8 [[I8:%.*]] to i32 147; GCN-NEXT: [[TMP4:%.*]] = sext i16 [[I16:%.*]] to i32 148; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 72) 149; GCN-NEXT: br label [[DOTSPLIT:%.*]] 150; GCN: .split: 151; GCN-NEXT: [[TMP5:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 152; GCN-NEXT: br i1 [[TMP5]], label [[TMP6:%.*]], label [[TMP7:%.*]] 153; GCN: 6: 154; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 155; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 156; GCN-NEXT: store i32 3, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 157; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 158; GCN-NEXT: store i32 [[TMP1]], ptr addrspace(1) [[PRINTBUFFGEP]], align 4 159; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 160; GCN-NEXT: store i32 [[TMP2]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 161; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 4 162; GCN-NEXT: store i32 [[TMP3]], ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 4 163; GCN-NEXT: [[PRINTBUFFNEXTPTR2:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], i32 4 164; GCN-NEXT: store i24 [[I24:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], align 4 165; GCN-NEXT: [[PRINTBUFFNEXTPTR3:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], i32 4 166; GCN-NEXT: store i32 [[TMP4]], ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], align 4 167; GCN-NEXT: [[PRINTBUFFNEXTPTR4:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], i32 4 168; GCN-NEXT: store i32 [[I32:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], align 4 169; GCN-NEXT: [[PRINTBUFFNEXTPTR5:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], i32 4 170; GCN-NEXT: store i64 [[I64:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], align 8 171; GCN-NEXT: [[PRINTBUFFNEXTPTR6:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], i32 8 172; GCN-NEXT: store i96 [[I96:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR6]], align 8 173; GCN-NEXT: [[PRINTBUFFNEXTPTR7:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR6]], i32 16 174; GCN-NEXT: store i128 [[I128:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR7]], align 8 175; GCN-NEXT: [[PRINTBUFFNEXTPTR8:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR7]], i32 16 176; GCN-NEXT: store i32 1234, ptr addrspace(1) [[PRINTBUFFNEXTPTR8]], align 4 177; GCN-NEXT: br label [[TMP7]] 178; GCN: 7: 179; GCN-NEXT: ret void 180; 181 %call = call i32 @printf(ptr addrspace(4) @format.str.d, i1 %i1, i4 %i4, i8 %i8, i24 %i24, i16 %i16, i32 %i32, i64 %i64, i96 %i96, i128 %i128, i32 1234) 182 ret void 183} 184 185define amdgpu_kernel void @format_str_u(i1 %i1, i4 %i4, i8 %i8, i24 %i24, i16 %i16, i32 %i32, i64 %i64, i96 %i96, i128 %i128) { 186; R600-LABEL: @format_str_u( 187; R600-NEXT: [[CALL:%.*]] = call i32 @printf(ptr addrspace(4) @format.str.u, i1 [[I1:%.*]], i4 [[I4:%.*]], i8 [[I8:%.*]], i24 [[I24:%.*]], i16 [[I16:%.*]], i32 [[I32:%.*]], i64 [[I64:%.*]], i96 [[I96:%.*]], i128 [[I128:%.*]], i32 1234) 188; R600-NEXT: ret void 189; 190; GCN-LABEL: @format_str_u( 191; GCN-NEXT: [[TMP1:%.*]] = zext i1 [[I1:%.*]] to i32 192; GCN-NEXT: [[TMP2:%.*]] = zext i4 [[I4:%.*]] to i32 193; GCN-NEXT: [[TMP3:%.*]] = zext i8 [[I8:%.*]] to i32 194; GCN-NEXT: [[TMP4:%.*]] = zext i16 [[I16:%.*]] to i32 195; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 72) 196; GCN-NEXT: br label [[DOTSPLIT:%.*]] 197; GCN: .split: 198; GCN-NEXT: [[TMP5:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 199; GCN-NEXT: br i1 [[TMP5]], label [[TMP6:%.*]], label [[TMP7:%.*]] 200; GCN: 6: 201; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 202; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 203; GCN-NEXT: store i32 4, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 204; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 205; GCN-NEXT: store i32 [[TMP1]], ptr addrspace(1) [[PRINTBUFFGEP]], align 4 206; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 207; GCN-NEXT: store i32 [[TMP2]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 208; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 4 209; GCN-NEXT: store i32 [[TMP3]], ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 4 210; GCN-NEXT: [[PRINTBUFFNEXTPTR2:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], i32 4 211; GCN-NEXT: store i24 [[I24:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], align 4 212; GCN-NEXT: [[PRINTBUFFNEXTPTR3:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], i32 4 213; GCN-NEXT: store i32 [[TMP4]], ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], align 4 214; GCN-NEXT: [[PRINTBUFFNEXTPTR4:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], i32 4 215; GCN-NEXT: store i32 [[I32:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], align 4 216; GCN-NEXT: [[PRINTBUFFNEXTPTR5:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], i32 4 217; GCN-NEXT: store i64 [[I64:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], align 8 218; GCN-NEXT: [[PRINTBUFFNEXTPTR6:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], i32 8 219; GCN-NEXT: store i96 [[I96:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR6]], align 8 220; GCN-NEXT: [[PRINTBUFFNEXTPTR7:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR6]], i32 16 221; GCN-NEXT: store i128 [[I128:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR7]], align 8 222; GCN-NEXT: [[PRINTBUFFNEXTPTR8:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR7]], i32 16 223; GCN-NEXT: store i32 1234, ptr addrspace(1) [[PRINTBUFFNEXTPTR8]], align 4 224; GCN-NEXT: br label [[TMP7]] 225; GCN: 7: 226; GCN-NEXT: ret void 227; 228 %call = call i32 @printf(ptr addrspace(4) @format.str.u, i1 %i1, i4 %i4, i8 %i8, i24 %i24, i16 %i16, i32 %i32, i64 %i64, i96 %i96, i128 %i128, i32 1234) 229 ret void 230} 231 232define void @format_str_v1(<1 x float> %v1f32.0, <1 x float> %v1f32.1, <1 x double> %v1f64, <1 x i8> %v1i8, <1 x i16> %v1i16, <1 x i32> %v1i32, <1 x i64> %v1i64, 233; R600-LABEL: @format_str_v1( 234; R600-NEXT: [[V1F32_1_FPEXT:%.*]] = fpext <1 x float> [[V1F32_1:%.*]] to <1 x double> 235; R600-NEXT: [[CALL1:%.*]] = call i32 @printf(ptr addrspace(4) @format.str.v1, <1 x float> [[V1F32_0:%.*]], <1 x double> [[V1F32_1_FPEXT]], <1 x double> [[V1F64:%.*]], <1 x i8> [[V1I8:%.*]], <1 x i16> [[V1I16:%.*]], <1 x i32> [[V1I32:%.*]], <1 x i64> [[V1I64:%.*]], <1 x ptr addrspace(1)> [[V1P1:%.*]], <1 x ptr addrspace(3)> [[V1P3:%.*]], <1 x half> [[V1F16:%.*]]) 236; R600-NEXT: ret void 237; 238; GCN-LABEL: @format_str_v1( 239; GCN-NEXT: [[V1F32_1_FPEXT:%.*]] = fpext <1 x float> [[V1F32_1:%.*]] to <1 x double> 240; GCN-NEXT: [[TMP1:%.*]] = sext <1 x i8> [[V1I8:%.*]] to <1 x i32> 241; GCN-NEXT: [[TMP2:%.*]] = sext <1 x i16> [[V1I16:%.*]] to <1 x i32> 242; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 44) 243; GCN-NEXT: br label [[DOTSPLIT:%.*]] 244; GCN: .split: 245; GCN-NEXT: [[TMP3:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 246; GCN-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP5:%.*]] 247; GCN: 4: 248; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 249; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 250; GCN-NEXT: store i32 5, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 251; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 252; GCN-NEXT: store <1 x float> [[V1F32_0:%.*]], ptr addrspace(1) [[PRINTBUFFGEP]], align 4 253; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 254; GCN-NEXT: store <1 x double> [[V1F32_1_FPEXT]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 8 255; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 8 256; GCN-NEXT: store <1 x double> [[V1F64:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 8 257; GCN-NEXT: [[PRINTBUFFNEXTPTR2:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], i32 8 258; GCN-NEXT: store <1 x i32> [[TMP1]], ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], align 4 259; GCN-NEXT: [[PRINTBUFFNEXTPTR3:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], i32 4 260; GCN-NEXT: store <1 x i32> [[TMP2]], ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], align 4 261; GCN-NEXT: [[PRINTBUFFNEXTPTR4:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], i32 4 262; GCN-NEXT: store <1 x i32> [[V1I32:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], align 4 263; GCN-NEXT: [[PRINTBUFFNEXTPTR5:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], i32 4 264; GCN-NEXT: store <1 x i64> [[V1I64:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], align 8 265; GCN-NEXT: [[PRINTBUFFNEXTPTR6:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], i32 8 266; GCN-NEXT: br label [[TMP5]] 267; GCN: 5: 268; GCN-NEXT: ret void 269; 270 <1 x ptr addrspace(1)> %v1p1, <1 x ptr addrspace(3)> %v1p3, <1 x half> %v1f16) { 271 %v1f32.1.fpext = fpext <1 x float> %v1f32.1 to <1 x double> 272 %call1 = call i32 @printf(ptr addrspace(4) @format.str.v1, <1 x float> %v1f32.0, <1 x double> %v1f32.1.fpext, <1 x double> %v1f64, <1 x i8> %v1i8, <1 x i16> %v1i16, <1 x i32> %v1i32, <1 x i64> %v1i64, 273 <1 x ptr addrspace(1)> %v1p1, <1 x ptr addrspace(3)> %v1p3, <1 x half> %v1f16) 274 ret void 275} 276 277define void @format_str_v2(<2 x float> %v2f32.0, <2 x float> %v2f32.1, <2 x double> %v2f64, <2 x i8> %v2i8, <2 x i16> %v2i16, <2 x i32> %v2i32, <2 x i64> %v2i64, 278; R600-LABEL: @format_str_v2( 279; R600-NEXT: [[V2F32_1_FPEXT:%.*]] = fpext <2 x float> [[V2F32_1:%.*]] to <2 x double> 280; R600-NEXT: [[CALL1:%.*]] = call i32 @printf(ptr addrspace(4) @format.str.v2, <2 x float> [[V2F32_0:%.*]], <2 x double> [[V2F32_1_FPEXT]], <2 x double> [[V2F64:%.*]], <2 x i8> [[V2I8:%.*]], <2 x i16> [[V2I16:%.*]], <2 x i32> [[V2I32:%.*]], <2 x i64> [[V2I64:%.*]], <2 x ptr addrspace(1)> [[V2P1:%.*]], <2 x ptr addrspace(3)> [[V2P3:%.*]], <2 x half> [[V2F16:%.*]]) 281; R600-NEXT: ret void 282; 283; GCN-LABEL: @format_str_v2( 284; GCN-NEXT: [[V2F32_1_FPEXT:%.*]] = fpext <2 x float> [[V2F32_1:%.*]] to <2 x double> 285; GCN-NEXT: [[TMP1:%.*]] = sext <2 x i8> [[V2I8:%.*]] to <2 x i32> 286; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 80) 287; GCN-NEXT: br label [[DOTSPLIT:%.*]] 288; GCN: .split: 289; GCN-NEXT: [[TMP2:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 290; GCN-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]] 291; GCN: 3: 292; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 293; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 294; GCN-NEXT: store i32 6, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 295; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 296; GCN-NEXT: store <2 x float> [[V2F32_0:%.*]], ptr addrspace(1) [[PRINTBUFFGEP]], align 8 297; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 8 298; GCN-NEXT: store <2 x double> [[V2F32_1_FPEXT]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 16 299; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 16 300; GCN-NEXT: store <2 x double> [[V2F64:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 16 301; GCN-NEXT: [[PRINTBUFFNEXTPTR2:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], i32 16 302; GCN-NEXT: store <2 x i32> [[TMP1]], ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], align 8 303; GCN-NEXT: [[PRINTBUFFNEXTPTR3:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], i32 8 304; GCN-NEXT: store <2 x i16> [[V2I16:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], align 4 305; GCN-NEXT: [[PRINTBUFFNEXTPTR4:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], i32 4 306; GCN-NEXT: store <2 x i32> [[V2I32:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], align 8 307; GCN-NEXT: [[PRINTBUFFNEXTPTR5:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], i32 8 308; GCN-NEXT: store <2 x i64> [[V2I64:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], align 16 309; GCN-NEXT: [[PRINTBUFFNEXTPTR6:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], i32 16 310; GCN-NEXT: br label [[TMP4]] 311; GCN: 4: 312; GCN-NEXT: ret void 313; 314 <2 x ptr addrspace(1)> %v2p1, <2 x ptr addrspace(3)> %v2p3, <2 x half> %v2f16) { 315 %v2f32.1.fpext = fpext <2 x float> %v2f32.1 to <2 x double> 316 %call1 = call i32 @printf(ptr addrspace(4) @format.str.v2, <2 x float> %v2f32.0, <2 x double> %v2f32.1.fpext, <2 x double> %v2f64, <2 x i8> %v2i8, <2 x i16> %v2i16, <2 x i32> %v2i32, <2 x i64> %v2i64, 317 <2 x ptr addrspace(1)> %v2p1, <2 x ptr addrspace(3)> %v2p3, <2 x half> %v2f16) 318 ret void 319} 320 321define void @format_str_v3(<3 x float> %v3f32.0, <3 x float> %v3f32.1, <3 x double> %v3f64, <3 x i8> %v3i8, <3 x i16> %v3i16, <3 x i32> %v3i32, <3 x i64> %v3i64, 322; R600-LABEL: @format_str_v3( 323; R600-NEXT: [[V3F32_1_FPEXT:%.*]] = fpext <3 x float> [[V3F32_1:%.*]] to <3 x double> 324; R600-NEXT: [[CALL1:%.*]] = call i32 @printf(ptr addrspace(4) @format.str.v3, <3 x float> [[V3F32_0:%.*]], <3 x double> [[V3F32_1_FPEXT]], <3 x double> [[V3F64:%.*]], <3 x i8> [[V3I8:%.*]], <3 x i16> [[V3I16:%.*]], <3 x i32> [[V3I32:%.*]], <3 x i64> [[V3I64:%.*]], <3 x ptr addrspace(1)> [[V3P1:%.*]], <3 x ptr addrspace(3)> [[V3P3:%.*]], <3 x half> [[V3F16:%.*]]) 325; R600-NEXT: ret void 326; 327; GCN-LABEL: @format_str_v3( 328; GCN-NEXT: [[V3F32_1_FPEXT:%.*]] = fpext <3 x float> [[V3F32_1:%.*]] to <3 x double> 329; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 144) 330; GCN-NEXT: br label [[DOTSPLIT:%.*]] 331; GCN: .split: 332; GCN-NEXT: [[TMP1:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 333; GCN-NEXT: br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP3:%.*]] 334; GCN: 2: 335; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 336; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 337; GCN-NEXT: store i32 7, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 338; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 339; GCN-NEXT: store <3 x float> [[V3F32_0:%.*]], ptr addrspace(1) [[PRINTBUFFGEP]], align 16 340; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 16 341; GCN-NEXT: store <3 x double> [[V3F32_1_FPEXT]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 32 342; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 32 343; GCN-NEXT: store <3 x double> [[V3F64:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 32 344; GCN-NEXT: [[PRINTBUFFNEXTPTR2:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], i32 32 345; GCN-NEXT: store <3 x i8> [[V3I8:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], align 4 346; GCN-NEXT: [[PRINTBUFFNEXTPTR3:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], i32 4 347; GCN-NEXT: store <3 x i16> [[V3I16:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], align 8 348; GCN-NEXT: [[PRINTBUFFNEXTPTR4:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], i32 8 349; GCN-NEXT: store <3 x i32> [[V3I32:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], align 16 350; GCN-NEXT: [[PRINTBUFFNEXTPTR5:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], i32 16 351; GCN-NEXT: store <3 x i64> [[V3I64:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], align 32 352; GCN-NEXT: [[PRINTBUFFNEXTPTR6:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], i32 32 353; GCN-NEXT: br label [[TMP3]] 354; GCN: 3: 355; GCN-NEXT: ret void 356; 357 <3 x ptr addrspace(1)> %v3p1, <3 x ptr addrspace(3)> %v3p3, <3 x half> %v3f16) { 358 %v3f32.1.fpext = fpext <3 x float> %v3f32.1 to <3 x double> 359 %call1 = call i32 @printf(ptr addrspace(4) @format.str.v3, <3 x float> %v3f32.0, <3 x double> %v3f32.1.fpext, <3 x double> %v3f64, <3 x i8> %v3i8, <3 x i16> %v3i16, <3 x i32> %v3i32, <3 x i64> %v3i64, 360 <3 x ptr addrspace(1)> %v3p1, <3 x ptr addrspace(3)> %v3p3, <3 x half> %v3f16) 361 ret void 362} 363 364define void @format_str_v4(<4 x float> %v4f32.0, <4 x float> %v4f32.1, <4 x double> %v4f64, <4 x i8> %v4i8, <4 x i16> %v4i16, <4 x i32> %v4i32, <4 x i64> %v4i64, 365; R600-LABEL: @format_str_v4( 366; R600-NEXT: [[V4F32_1_FPEXT:%.*]] = fpext <4 x float> [[V4F32_1:%.*]] to <4 x double> 367; R600-NEXT: [[CALL1:%.*]] = call i32 @printf(ptr addrspace(4) @format.str.v4, <4 x float> [[V4F32_0:%.*]], <4 x double> [[V4F32_1_FPEXT]], <4 x double> [[V4F64:%.*]], <4 x i8> [[V4I8:%.*]], <4 x i16> [[V4I16:%.*]], <4 x i32> [[V4I32:%.*]], <4 x i64> [[V4I64:%.*]], <4 x ptr addrspace(1)> [[V4P1:%.*]], <4 x ptr addrspace(3)> [[V4P3:%.*]], <4 x half> [[V4F16:%.*]]) 368; R600-NEXT: ret void 369; 370; GCN-LABEL: @format_str_v4( 371; GCN-NEXT: [[V4F32_1_FPEXT:%.*]] = fpext <4 x float> [[V4F32_1:%.*]] to <4 x double> 372; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 144) 373; GCN-NEXT: br label [[DOTSPLIT:%.*]] 374; GCN: .split: 375; GCN-NEXT: [[TMP1:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 376; GCN-NEXT: br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP3:%.*]] 377; GCN: 2: 378; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 379; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 380; GCN-NEXT: store i32 8, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 381; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 382; GCN-NEXT: store <4 x float> [[V4F32_0:%.*]], ptr addrspace(1) [[PRINTBUFFGEP]], align 16 383; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 16 384; GCN-NEXT: store <4 x double> [[V4F32_1_FPEXT]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 32 385; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 32 386; GCN-NEXT: store <4 x double> [[V4F64:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 32 387; GCN-NEXT: [[PRINTBUFFNEXTPTR2:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], i32 32 388; GCN-NEXT: store <4 x i8> [[V4I8:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], align 4 389; GCN-NEXT: [[PRINTBUFFNEXTPTR3:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], i32 4 390; GCN-NEXT: store <4 x i16> [[V4I16:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], align 8 391; GCN-NEXT: [[PRINTBUFFNEXTPTR4:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], i32 8 392; GCN-NEXT: store <4 x i32> [[V4I32:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], align 16 393; GCN-NEXT: [[PRINTBUFFNEXTPTR5:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], i32 16 394; GCN-NEXT: store <4 x i64> [[V4I64:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], align 32 395; GCN-NEXT: [[PRINTBUFFNEXTPTR6:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], i32 32 396; GCN-NEXT: br label [[TMP3]] 397; GCN: 3: 398; GCN-NEXT: ret void 399; 400 <4 x ptr addrspace(1)> %v4p1, <4 x ptr addrspace(3)> %v4p3, <4 x half> %v4f16) { 401 %v4f32.1.fpext = fpext <4 x float> %v4f32.1 to <4 x double> 402 %call1 = call i32 @printf(ptr addrspace(4) @format.str.v4, <4 x float> %v4f32.0, <4 x double> %v4f32.1.fpext, <4 x double> %v4f64, <4 x i8> %v4i8, <4 x i16> %v4i16, <4 x i32> %v4i32, <4 x i64> %v4i64, 403 <4 x ptr addrspace(1)> %v4p1, <4 x ptr addrspace(3)> %v4p3, <4 x half> %v4f16) 404 ret void 405} 406 407define void @format_str_v8(<8 x float> %v8f32.0, <8 x float> %v8f32.1, <8 x double> %v8f64, <8 x i8> %v8i8, <8 x i16> %v8i16, <8 x i32> %v8i32, <8 x i64> %v8i64, 408; R600-LABEL: @format_str_v8( 409; R600-NEXT: [[V8F32_1_FPEXT:%.*]] = fpext <8 x float> [[V8F32_1:%.*]] to <8 x double> 410; R600-NEXT: [[CALL1:%.*]] = call i32 @printf(ptr addrspace(4) @format.str.v8, <8 x float> [[V8F32_0:%.*]], <8 x double> [[V8F32_1_FPEXT]], <8 x double> [[V8F64:%.*]], <8 x i8> [[V8I8:%.*]], <8 x i16> [[V8I16:%.*]], <8 x i32> [[V8I32:%.*]], <8 x i64> [[V8I64:%.*]], <8 x ptr addrspace(1)> [[V8P1:%.*]], <8 x ptr addrspace(3)> [[V8P3:%.*]], <8 x half> [[V8F16:%.*]]) 411; R600-NEXT: ret void 412; 413; GCN-LABEL: @format_str_v8( 414; GCN-NEXT: [[V8F32_1_FPEXT:%.*]] = fpext <8 x float> [[V8F32_1:%.*]] to <8 x double> 415; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 284) 416; GCN-NEXT: br label [[DOTSPLIT:%.*]] 417; GCN: .split: 418; GCN-NEXT: [[TMP1:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 419; GCN-NEXT: br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP3:%.*]] 420; GCN: 2: 421; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 422; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 423; GCN-NEXT: store i32 9, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 424; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 425; GCN-NEXT: store <8 x float> [[V8F32_0:%.*]], ptr addrspace(1) [[PRINTBUFFGEP]], align 32 426; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 32 427; GCN-NEXT: store <8 x double> [[V8F32_1_FPEXT]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 64 428; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 64 429; GCN-NEXT: store <8 x double> [[V8F64:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 64 430; GCN-NEXT: [[PRINTBUFFNEXTPTR2:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], i32 64 431; GCN-NEXT: store <8 x i8> [[V8I8:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], align 8 432; GCN-NEXT: [[PRINTBUFFNEXTPTR3:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], i32 8 433; GCN-NEXT: store <8 x i16> [[V8I16:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], align 16 434; GCN-NEXT: [[PRINTBUFFNEXTPTR4:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], i32 16 435; GCN-NEXT: store <8 x i32> [[V8I32:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], align 32 436; GCN-NEXT: [[PRINTBUFFNEXTPTR5:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], i32 32 437; GCN-NEXT: store <8 x i64> [[V8I64:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], align 64 438; GCN-NEXT: [[PRINTBUFFNEXTPTR6:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], i32 64 439; GCN-NEXT: br label [[TMP3]] 440; GCN: 3: 441; GCN-NEXT: ret void 442; 443 <8 x ptr addrspace(1)> %v8p1, <8 x ptr addrspace(3)> %v8p3, <8 x half> %v8f16) { 444 %v8f32.1.fpext = fpext <8 x float> %v8f32.1 to <8 x double> 445 %call1 = call i32 @printf(ptr addrspace(4) @format.str.v8, <8 x float> %v8f32.0, <8 x double> %v8f32.1.fpext, <8 x double> %v8f64, <8 x i8> %v8i8, <8 x i16> %v8i16, <8 x i32> %v8i32, <8 x i64> %v8i64, 446 <8 x ptr addrspace(1)> %v8p1, <8 x ptr addrspace(3)> %v8p3, <8 x half> %v8f16) 447 ret void 448} 449 450define void @format_str_v16(<16 x float> %v16f32.0, <16 x float> %v16f32.1, <16 x double> %v16f64, <16 x i8> %v16i8, <16 x i16> %v16i16, <16 x i32> %v16i32, <16 x i64> %v16i64, 451; R600-LABEL: @format_str_v16( 452; R600-NEXT: [[V16F32_1_FPEXT:%.*]] = fpext <16 x float> [[V16F32_1:%.*]] to <16 x double> 453; R600-NEXT: [[CALL1:%.*]] = call i32 @printf(ptr addrspace(4) @format.str.v16, <16 x float> [[V16F32_0:%.*]], <16 x double> [[V16F32_1_FPEXT]], <16 x double> [[V16F64:%.*]], <16 x i8> [[V16I8:%.*]], <16 x i16> [[V16I16:%.*]], <16 x i32> [[V16I32:%.*]], <16 x i64> [[V16I64:%.*]], <16 x ptr addrspace(1)> [[V16P1:%.*]], <16 x ptr addrspace(3)> [[V16P3:%.*]], <16 x half> [[V16F16:%.*]]) 454; R600-NEXT: ret void 455; 456; GCN-LABEL: @format_str_v16( 457; GCN-NEXT: [[V16F32_1_FPEXT:%.*]] = fpext <16 x float> [[V16F32_1:%.*]] to <16 x double> 458; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 564) 459; GCN-NEXT: br label [[DOTSPLIT:%.*]] 460; GCN: .split: 461; GCN-NEXT: [[TMP1:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 462; GCN-NEXT: br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP3:%.*]] 463; GCN: 2: 464; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 465; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 466; GCN-NEXT: store i32 10, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 467; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 468; GCN-NEXT: store <16 x float> [[V16F32_0:%.*]], ptr addrspace(1) [[PRINTBUFFGEP]], align 64 469; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 64 470; GCN-NEXT: store <16 x double> [[V16F32_1_FPEXT]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 128 471; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 128 472; GCN-NEXT: store <16 x double> [[V16F64:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 128 473; GCN-NEXT: [[PRINTBUFFNEXTPTR2:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], i32 128 474; GCN-NEXT: store <16 x i8> [[V16I8:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], align 16 475; GCN-NEXT: [[PRINTBUFFNEXTPTR3:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], i32 16 476; GCN-NEXT: store <16 x i16> [[V16I16:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], align 32 477; GCN-NEXT: [[PRINTBUFFNEXTPTR4:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], i32 32 478; GCN-NEXT: store <16 x i32> [[V16I32:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], align 64 479; GCN-NEXT: [[PRINTBUFFNEXTPTR5:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], i32 64 480; GCN-NEXT: store <16 x i64> [[V16I64:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], align 128 481; GCN-NEXT: [[PRINTBUFFNEXTPTR6:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], i32 128 482; GCN-NEXT: br label [[TMP3]] 483; GCN: 3: 484; GCN-NEXT: ret void 485; 486 <16 x ptr addrspace(1)> %v16p1, <16 x ptr addrspace(3)> %v16p3, <16 x half> %v16f16) { 487 %v16f32.1.fpext = fpext <16 x float> %v16f32.1 to <16 x double> 488 %call1 = call i32 @printf(ptr addrspace(4) @format.str.v16, <16 x float> %v16f32.0, <16 x double> %v16f32.1.fpext, <16 x double> %v16f64, <16 x i8> %v16i8, <16 x i16> %v16i16, <16 x i32> %v16i32, <16 x i64> %v16i64, 489 <16 x ptr addrspace(1)> %v16p1, <16 x ptr addrspace(3)> %v16p3, <16 x half> %v16f16) 490 ret void 491} 492 493define amdgpu_kernel void @test_kernel(i32 %n) { 494; R600-LABEL: @test_kernel( 495; R600-NEXT: entry: 496; R600-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 497; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(5) [[STR]], i32 [[N:%.*]]) 498; R600-NEXT: ret void 499; 500; GCN-LABEL: @test_kernel( 501; GCN-NEXT: entry: 502; GCN-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 503; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 504; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 505; GCN: entry.split: 506; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 507; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 508; GCN: 1: 509; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 510; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 511; GCN-NEXT: store i32 11, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 512; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 513; GCN-NEXT: store i32 4144959, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 514; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 515; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 516; GCN-NEXT: br label [[TMP2]] 517; GCN: 2: 518; GCN-NEXT: ret void 519; 520entry: 521 %str = alloca [9 x i8], align 1, addrspace(5) 522 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(5) %str, i32 %n) 523 ret void 524} 525 526define amdgpu_kernel void @test_format_str_no_null_terminator(i32 %n) { 527; R600-LABEL: @test_format_str_no_null_terminator( 528; R600-NEXT: entry: 529; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @format.str.no.null.terminator, i32 [[N:%.*]]) 530; R600-NEXT: ret void 531; 532; GCN-LABEL: @test_format_str_no_null_terminator( 533; GCN-NEXT: entry: 534; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 8) 535; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 536; GCN: entry.split: 537; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 538; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 539; GCN: 1: 540; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 541; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 542; GCN-NEXT: store i32 12, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 543; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 544; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFGEP]], align 4 545; GCN-NEXT: br label [[TMP2]] 546; GCN: 2: 547; GCN-NEXT: ret void 548; 549entry: 550 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @format.str.no.null.terminator, i32 %n) 551 ret void 552} 553 554 555define amdgpu_kernel void @test_indexed_format_str(i32 %n) { 556; R600-LABEL: @test_indexed_format_str( 557; R600-NEXT: entry: 558; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) getelementptr ([11 x i8], ptr addrspace(4) @indexed.format.str, i64 0, i32 7), i32 [[N:%.*]]) 559; R600-NEXT: ret void 560; 561; GCN-LABEL: @test_indexed_format_str( 562; GCN-NEXT: entry: 563; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 8) 564; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 565; GCN: entry.split: 566; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 567; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 568; GCN: 1: 569; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 570; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 571; GCN-NEXT: store i32 13, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 572; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 573; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFGEP]], align 4 574; GCN-NEXT: br label [[TMP2]] 575; GCN: 2: 576; GCN-NEXT: ret void 577; 578entry: 579 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) getelementptr ([11 x i8], ptr addrspace(4) @indexed.format.str, i64 0, i32 7), i32 %n) 580 ret void 581} 582 583define amdgpu_kernel void @test_indexed_format_str_oob(i32 %n) { 584; R600-LABEL: @test_indexed_format_str_oob( 585; R600-NEXT: entry: 586; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) getelementptr ([11 x i8], ptr addrspace(4) @indexed.format.str, i64 0, i64 11), i32 [[N:%.*]]) 587; R600-NEXT: ret void 588; 589; GCN-LABEL: @test_indexed_format_str_oob( 590; GCN-NEXT: entry: 591; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 4) 592; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 593; GCN: entry.split: 594; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 595; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 596; GCN: 1: 597; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 598; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 599; GCN-NEXT: store i32 14, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 600; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 601; GCN-NEXT: br label [[TMP2]] 602; GCN: 2: 603; GCN-NEXT: ret void 604; 605entry: 606 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) getelementptr ([11 x i8], ptr addrspace(4) @indexed.format.str, i64 0, i64 11), i32 %n) 607 ret void 608} 609 610define amdgpu_kernel void @string_pointee_type(i32 %n) { 611; R600-LABEL: @string_pointee_type( 612; R600-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 613; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(5) [[STR]], i32 [[N:%.*]]) 614; R600-NEXT: ret void 615; 616; GCN-LABEL: @string_pointee_type( 617; GCN-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 618; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 619; GCN-NEXT: br label [[DOTSPLIT:%.*]] 620; GCN: .split: 621; GCN-NEXT: [[TMP1:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 622; GCN-NEXT: br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP3:%.*]] 623; GCN: 2: 624; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 625; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 626; GCN-NEXT: store i32 15, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 627; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 628; GCN-NEXT: store i32 4144959, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 629; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 630; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 631; GCN-NEXT: br label [[TMP3]] 632; GCN: 3: 633; GCN-NEXT: ret void 634; 635 %str = alloca [9 x i8], align 1, addrspace(5) 636 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(5) %str, i32 %n) 637 ret void 638} 639 640define amdgpu_kernel void @string_address_space4(i32 %n, ptr addrspace(4) %str) { 641; R600-LABEL: @string_address_space4( 642; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) [[STR:%.*]], i32 [[N:%.*]]) 643; R600-NEXT: ret void 644; 645; GCN-LABEL: @string_address_space4( 646; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 647; GCN-NEXT: br label [[DOTSPLIT:%.*]] 648; GCN: .split: 649; GCN-NEXT: [[TMP1:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 650; GCN-NEXT: br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP3:%.*]] 651; GCN: 2: 652; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 653; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 654; GCN-NEXT: store i32 16, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 655; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 656; GCN-NEXT: store i32 4144959, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 657; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 658; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 659; GCN-NEXT: br label [[TMP3]] 660; GCN: 3: 661; GCN-NEXT: ret void 662; 663 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) %str, i32 %n) 664 ret void 665} 666 667define amdgpu_kernel void @string_address_space1(i32 %n, ptr addrspace(1) %str) { 668; R600-LABEL: @string_address_space1( 669; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(1) [[STR:%.*]], i32 [[N:%.*]]) 670; R600-NEXT: ret void 671; 672; GCN-LABEL: @string_address_space1( 673; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 674; GCN-NEXT: br label [[DOTSPLIT:%.*]] 675; GCN: .split: 676; GCN-NEXT: [[TMP1:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 677; GCN-NEXT: br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP3:%.*]] 678; GCN: 2: 679; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 680; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 681; GCN-NEXT: store i32 17, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 682; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 683; GCN-NEXT: store i32 4144959, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 684; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 685; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 686; GCN-NEXT: br label [[TMP3]] 687; GCN: 3: 688; GCN-NEXT: ret void 689; 690 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(1) %str, i32 %n) 691 ret void 692} 693 694define amdgpu_kernel void @string_format_passed_i32(i32 %n, i32 %str) { 695; R600-LABEL: @string_format_passed_i32( 696; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, i32 [[STR:%.*]], i32 [[N:%.*]]) 697; R600-NEXT: ret void 698; 699; GCN-LABEL: @string_format_passed_i32( 700; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 701; GCN-NEXT: br label [[DOTSPLIT:%.*]] 702; GCN: .split: 703; GCN-NEXT: [[TMP1:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 704; GCN-NEXT: br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP3:%.*]] 705; GCN: 2: 706; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 707; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 708; GCN-NEXT: store i32 18, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 709; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 710; GCN-NEXT: store i32 [[STR:%.*]], ptr addrspace(1) [[PRINTBUFFGEP]], align 4 711; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 712; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 713; GCN-NEXT: br label [[TMP3]] 714; GCN: 3: 715; GCN-NEXT: ret void 716; 717 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, i32 %str, i32 %n) 718 ret void 719} 720 721 722@str.as1 = private unnamed_addr addrspace(1) constant [6 x i8] c"%s:%d\00", align 1 723 724define amdgpu_kernel void @test_kernel_addrspacecasted_format_str(i32 %n) { 725; R600-LABEL: @test_kernel_addrspacecasted_format_str( 726; R600-NEXT: entry: 727; R600-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 728; R600-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [9 x i8], ptr addrspace(5) [[STR]], i32 0, i32 0 729; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) addrspacecast (ptr addrspace(1) @str.as1 to ptr addrspace(4)), ptr addrspace(5) [[ARRAYDECAY]], i32 [[N:%.*]]) 730; R600-NEXT: ret void 731; 732; GCN-LABEL: @test_kernel_addrspacecasted_format_str( 733; GCN-NEXT: entry: 734; GCN-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 735; GCN-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [9 x i8], ptr addrspace(5) [[STR]], i32 0, i32 0 736; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 737; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 738; GCN: entry.split: 739; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 740; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 741; GCN: 1: 742; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 743; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 744; GCN-NEXT: store i32 19, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 745; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 746; GCN-NEXT: store i32 4144959, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 747; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 748; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 749; GCN-NEXT: br label [[TMP2]] 750; GCN: 2: 751; GCN-NEXT: ret void 752; 753entry: 754 %str = alloca [9 x i8], align 1, addrspace(5) 755 %arraydecay = getelementptr inbounds [9 x i8], ptr addrspace(5) %str, i32 0, i32 0 756 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) addrspacecast (ptr addrspace(1) @str.as1 to ptr addrspace(4)), ptr addrspace(5) %arraydecay, i32 %n) 757 ret void 758} 759 760define amdgpu_kernel void @test_undef_argument(i32 %n) { 761; R600-LABEL: @test_undef_argument( 762; R600-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 763; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) undef, ptr addrspace(5) [[STR]], i32 [[N:%.*]]) 764; R600-NEXT: ret void 765; 766; GCN-LABEL: @test_undef_argument( 767; GCN-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 768; GCN-NEXT: ret void 769; 770 %str = alloca [9 x i8], align 1, addrspace(5) 771 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) undef, ptr addrspace(5) %str, i32 %n) 772 ret void 773} 774 775define amdgpu_kernel void @test_poison_argument(i32 %n) { 776; R600-LABEL: @test_poison_argument( 777; R600-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 778; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) poison, ptr addrspace(5) [[STR]], i32 [[N:%.*]]) 779; R600-NEXT: ret void 780; 781; GCN-LABEL: @test_poison_argument( 782; GCN-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 783; GCN-NEXT: ret void 784; 785 %str = alloca [9 x i8], align 1, addrspace(5) 786 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) poison, ptr addrspace(5) %str, i32 %n) 787 ret void 788} 789 790define amdgpu_kernel void @test_null_argument(i32 %n) { 791; R600-LABEL: @test_null_argument( 792; R600-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 793; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) null, ptr addrspace(5) [[STR]], i32 [[N:%.*]]) 794; R600-NEXT: ret void 795; 796; GCN-LABEL: @test_null_argument( 797; GCN-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 798; GCN-NEXT: ret void 799; 800 %str = alloca [9 x i8], align 1, addrspace(5) 801 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) null, ptr addrspace(5) %str, i32 %n) 802 ret void 803} 804 805@undef.initializer = private unnamed_addr addrspace(4) constant [6 x i8] undef 806 807define amdgpu_kernel void @undef_initializer_gv(i32 %n) { 808; R600-LABEL: @undef_initializer_gv( 809; R600-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 810; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @poison.initializer, ptr addrspace(5) [[STR]], i32 [[N:%.*]]) 811; R600-NEXT: ret void 812; 813; GCN-LABEL: @undef_initializer_gv( 814; GCN-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 815; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 4) 816; GCN-NEXT: br label [[DOTSPLIT:%.*]] 817; GCN: .split: 818; GCN-NEXT: [[TMP1:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 819; GCN-NEXT: br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP3:%.*]] 820; GCN: 2: 821; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 822; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 823; GCN-NEXT: store i32 20, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 824; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 825; GCN-NEXT: br label [[TMP3]] 826; GCN: 3: 827; GCN-NEXT: ret void 828; 829 %str = alloca [9 x i8], align 1, addrspace(5) 830 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @poison.initializer, ptr addrspace(5) %str, i32 %n) 831 ret void 832} 833 834@poison.initializer = private unnamed_addr addrspace(4) constant [6 x i8] poison 835 836define amdgpu_kernel void @poison_initializer_gv(i32 %n) { 837; R600-LABEL: @poison_initializer_gv( 838; R600-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 839; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @poison.initializer, ptr addrspace(5) [[STR]], i32 [[N:%.*]]) 840; R600-NEXT: ret void 841; 842; GCN-LABEL: @poison_initializer_gv( 843; GCN-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 844; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 4) 845; GCN-NEXT: br label [[DOTSPLIT:%.*]] 846; GCN: .split: 847; GCN-NEXT: [[TMP1:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 848; GCN-NEXT: br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP3:%.*]] 849; GCN: 2: 850; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 851; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 852; GCN-NEXT: store i32 21, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 853; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 854; GCN-NEXT: br label [[TMP3]] 855; GCN: 3: 856; GCN-NEXT: ret void 857; 858 %str = alloca [9 x i8], align 1, addrspace(5) 859 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @poison.initializer, ptr addrspace(5) %str, i32 %n) 860 ret void 861} 862 863@zero.initializer = private unnamed_addr addrspace(4) constant [6 x i8] zeroinitializer 864 865define amdgpu_kernel void @zero_initializer_gv(i32 %n) { 866; R600-LABEL: @zero_initializer_gv( 867; R600-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 868; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @poison.initializer, ptr addrspace(5) [[STR]], i32 [[N:%.*]]) 869; R600-NEXT: ret void 870; 871; GCN-LABEL: @zero_initializer_gv( 872; GCN-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 873; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 4) 874; GCN-NEXT: br label [[DOTSPLIT:%.*]] 875; GCN: .split: 876; GCN-NEXT: [[TMP1:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 877; GCN-NEXT: br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP3:%.*]] 878; GCN: 2: 879; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 880; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 881; GCN-NEXT: store i32 22, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 882; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 883; GCN-NEXT: br label [[TMP3]] 884; GCN: 3: 885; GCN-NEXT: ret void 886; 887 %str = alloca [9 x i8], align 1, addrspace(5) 888 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @poison.initializer, ptr addrspace(5) %str, i32 %n) 889 ret void 890} 891 892define amdgpu_kernel void @test_print_string_literal_size0(i32 %n) { 893; R600-LABEL: @test_print_string_literal_size0( 894; R600-NEXT: entry: 895; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size0, i32 [[N:%.*]]) 896; R600-NEXT: ret void 897; 898; GCN-LABEL: @test_print_string_literal_size0( 899; GCN-NEXT: entry: 900; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 901; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 902; GCN: entry.split: 903; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 904; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 905; GCN: 1: 906; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 907; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 908; GCN-NEXT: store i32 23, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 909; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 910; GCN-NEXT: store i32 -256, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 911; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 912; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 913; GCN-NEXT: br label [[TMP2]] 914; GCN: 2: 915; GCN-NEXT: ret void 916; 917entry: 918 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size0, i32 %n) 919 ret void 920} 921 922define amdgpu_kernel void @test_print_string_literal_1ai8.zero(i32 %n) { 923; R600-LABEL: @test_print_string_literal_1ai8.zero( 924; R600-NEXT: entry: 925; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.1ai8.zero, i32 [[N:%.*]]) 926; R600-NEXT: ret void 927; 928; GCN-LABEL: @test_print_string_literal_1ai8.zero( 929; GCN-NEXT: entry: 930; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 931; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 932; GCN: entry.split: 933; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 934; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 935; GCN: 1: 936; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 937; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 938; GCN-NEXT: store i32 24, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 939; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 940; GCN-NEXT: store i32 -256, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 941; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 942; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 943; GCN-NEXT: br label [[TMP2]] 944; GCN: 2: 945; GCN-NEXT: ret void 946; 947entry: 948 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.1ai8.zero, i32 %n) 949 ret void 950} 951 952define amdgpu_kernel void @test_print_string_literal_1ai8.undef(i32 %n) { 953; R600-LABEL: @test_print_string_literal_1ai8.undef( 954; R600-NEXT: entry: 955; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.1ai8.undef, i32 [[N:%.*]]) 956; R600-NEXT: ret void 957; 958; GCN-LABEL: @test_print_string_literal_1ai8.undef( 959; GCN-NEXT: entry: 960; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 961; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 962; GCN: entry.split: 963; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 964; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 965; GCN: 1: 966; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 967; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 968; GCN-NEXT: store i32 25, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 969; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 970; GCN-NEXT: store i32 -256, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 971; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 972; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 973; GCN-NEXT: br label [[TMP2]] 974; GCN: 2: 975; GCN-NEXT: ret void 976; 977entry: 978 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.1ai8.undef, i32 %n) 979 ret void 980} 981 982define amdgpu_kernel void @test_print_string_literal_i8.zero(i32 %n) { 983; R600-LABEL: @test_print_string_literal_i8.zero( 984; R600-NEXT: entry: 985; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.i8.zero, i32 [[N:%.*]]) 986; R600-NEXT: ret void 987; 988; GCN-LABEL: @test_print_string_literal_i8.zero( 989; GCN-NEXT: entry: 990; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 991; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 992; GCN: entry.split: 993; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 994; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 995; GCN: 1: 996; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 997; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 998; GCN-NEXT: store i32 26, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 999; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1000; GCN-NEXT: store i32 -256, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1001; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1002; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1003; GCN-NEXT: br label [[TMP2]] 1004; GCN: 2: 1005; GCN-NEXT: ret void 1006; 1007entry: 1008 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.i8.zero, i32 %n) 1009 ret void 1010} 1011 1012define amdgpu_kernel void @test_print_string_literal_size2(i32 %n) { 1013; R600-LABEL: @test_print_string_literal_size2( 1014; R600-NEXT: entry: 1015; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size2, i32 [[N:%.*]]) 1016; R600-NEXT: ret void 1017; 1018; GCN-LABEL: @test_print_string_literal_size2( 1019; GCN-NEXT: entry: 1020; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1021; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1022; GCN: entry.split: 1023; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1024; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1025; GCN: 1: 1026; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1027; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1028; GCN-NEXT: store i32 27, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1029; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1030; GCN-NEXT: store i32 27, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1031; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1032; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1033; GCN-NEXT: br label [[TMP2]] 1034; GCN: 2: 1035; GCN-NEXT: ret void 1036; 1037entry: 1038 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size2, i32 %n) 1039 ret void 1040} 1041 1042define amdgpu_kernel void @test_print_string_literal_size3(i32 %n) { 1043; R600-LABEL: @test_print_string_literal_size3( 1044; R600-NEXT: entry: 1045; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size3, i32 [[N:%.*]]) 1046; R600-NEXT: ret void 1047; 1048; GCN-LABEL: @test_print_string_literal_size3( 1049; GCN-NEXT: entry: 1050; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1051; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1052; GCN: entry.split: 1053; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1054; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1055; GCN: 1: 1056; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1057; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1058; GCN-NEXT: store i32 28, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1059; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1060; GCN-NEXT: store i32 7195, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1061; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1062; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1063; GCN-NEXT: br label [[TMP2]] 1064; GCN: 2: 1065; GCN-NEXT: ret void 1066; 1067entry: 1068 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size3, i32 %n) 1069 ret void 1070} 1071 1072define amdgpu_kernel void @test_print_string_literal_size3_zero(i32 %n) { 1073; R600-LABEL: @test_print_string_literal_size3_zero( 1074; R600-NEXT: entry: 1075; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size3.zero, i32 [[N:%.*]]) 1076; R600-NEXT: ret void 1077; 1078; GCN-LABEL: @test_print_string_literal_size3_zero( 1079; GCN-NEXT: entry: 1080; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1081; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1082; GCN: entry.split: 1083; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1084; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1085; GCN: 1: 1086; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1087; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1088; GCN-NEXT: store i32 29, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1089; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1090; GCN-NEXT: store i32 -256, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1091; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1092; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1093; GCN-NEXT: br label [[TMP2]] 1094; GCN: 2: 1095; GCN-NEXT: ret void 1096; 1097entry: 1098 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size3.zero, i32 %n) 1099 ret void 1100} 1101 1102define amdgpu_kernel void @test_print_string_literal_size4(i32 %n) { 1103; R600-LABEL: @test_print_string_literal_size4( 1104; R600-NEXT: entry: 1105; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size4, i32 [[N:%.*]]) 1106; R600-NEXT: ret void 1107; 1108; GCN-LABEL: @test_print_string_literal_size4( 1109; GCN-NEXT: entry: 1110; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1111; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1112; GCN: entry.split: 1113; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1114; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1115; GCN: 1: 1116; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1117; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1118; GCN-NEXT: store i32 30, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1119; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1120; GCN-NEXT: store i32 6513249, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1121; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1122; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1123; GCN-NEXT: br label [[TMP2]] 1124; GCN: 2: 1125; GCN-NEXT: ret void 1126; 1127entry: 1128 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size4, i32 %n) 1129 ret void 1130} 1131 1132define amdgpu_kernel void @test_print_string_literal_size4_nonull_term(i32 %n) { 1133; R600-LABEL: @test_print_string_literal_size4_nonull_term( 1134; R600-NEXT: entry: 1135; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size4.nonull.term, i32 [[N:%.*]]) 1136; R600-NEXT: ret void 1137; 1138; GCN-LABEL: @test_print_string_literal_size4_nonull_term( 1139; GCN-NEXT: entry: 1140; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 16) 1141; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1142; GCN: entry.split: 1143; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1144; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1145; GCN: 1: 1146; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1147; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1148; GCN-NEXT: store i32 31, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1149; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1150; GCN-NEXT: store i32 1684234849, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1151; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1152; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1153; GCN-NEXT: br label [[TMP2]] 1154; GCN: 2: 1155; GCN-NEXT: ret void 1156; 1157entry: 1158 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size4.nonull.term, i32 %n) 1159 ret void 1160} 1161 1162define amdgpu_kernel void @test_print_string_literal_size5(i32 %n) { 1163; R600-LABEL: @test_print_string_literal_size5( 1164; R600-NEXT: entry: 1165; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size5, i32 [[N:%.*]]) 1166; R600-NEXT: ret void 1167; 1168; GCN-LABEL: @test_print_string_literal_size5( 1169; GCN-NEXT: entry: 1170; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 16) 1171; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1172; GCN: entry.split: 1173; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1174; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1175; GCN: 1: 1176; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1177; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1178; GCN-NEXT: store i32 32, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1179; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1180; GCN-NEXT: store i32 1684234849, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1181; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1182; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1183; GCN-NEXT: br label [[TMP2]] 1184; GCN: 2: 1185; GCN-NEXT: ret void 1186; 1187entry: 1188 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size5, i32 %n) 1189 ret void 1190} 1191 1192define amdgpu_kernel void @test_print_string_literal_size6(i32 %n) { 1193; R600-LABEL: @test_print_string_literal_size6( 1194; R600-NEXT: entry: 1195; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size6, i32 [[N:%.*]]) 1196; R600-NEXT: ret void 1197; 1198; GCN-LABEL: @test_print_string_literal_size6( 1199; GCN-NEXT: entry: 1200; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 16) 1201; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1202; GCN: entry.split: 1203; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1204; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1205; GCN: 1: 1206; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1207; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1208; GCN-NEXT: store i32 33, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1209; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1210; GCN-NEXT: store i32 1684234849, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1211; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1212; GCN-NEXT: store i32 101, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1213; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 4 1214; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 4 1215; GCN-NEXT: br label [[TMP2]] 1216; GCN: 2: 1217; GCN-NEXT: ret void 1218; 1219entry: 1220 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size6, i32 %n) 1221 ret void 1222} 1223 1224define amdgpu_kernel void @test_print_string_literal_size7(i32 %n) { 1225; R600-LABEL: @test_print_string_literal_size7( 1226; R600-NEXT: entry: 1227; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size6, i32 [[N:%.*]]) 1228; R600-NEXT: ret void 1229; 1230; GCN-LABEL: @test_print_string_literal_size7( 1231; GCN-NEXT: entry: 1232; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 16) 1233; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1234; GCN: entry.split: 1235; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1236; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1237; GCN: 1: 1238; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1239; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1240; GCN-NEXT: store i32 34, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1241; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1242; GCN-NEXT: store i32 1684234849, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1243; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1244; GCN-NEXT: store i32 101, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1245; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 4 1246; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 4 1247; GCN-NEXT: br label [[TMP2]] 1248; GCN: 2: 1249; GCN-NEXT: ret void 1250; 1251entry: 1252 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size6, i32 %n) 1253 ret void 1254} 1255 1256define amdgpu_kernel void @test_print_string_literal_size8(i32 %n) { 1257; R600-LABEL: @test_print_string_literal_size8( 1258; R600-NEXT: entry: 1259; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size8, i32 [[N:%.*]]) 1260; R600-NEXT: ret void 1261; 1262; GCN-LABEL: @test_print_string_literal_size8( 1263; GCN-NEXT: entry: 1264; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 16) 1265; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1266; GCN: entry.split: 1267; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1268; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1269; GCN: 1: 1270; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1271; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1272; GCN-NEXT: store i32 35, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1273; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1274; GCN-NEXT: store i32 1953722977, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1275; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1276; GCN-NEXT: store i32 7565921, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1277; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 4 1278; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 4 1279; GCN-NEXT: br label [[TMP2]] 1280; GCN: 2: 1281; GCN-NEXT: ret void 1282; 1283entry: 1284 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size8, i32 %n) 1285 ret void 1286} 1287 1288define amdgpu_kernel void @test_print_string_literal_size9(i32 %n) { 1289; R600-LABEL: @test_print_string_literal_size9( 1290; R600-NEXT: entry: 1291; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size9, i32 [[N:%.*]]) 1292; R600-NEXT: ret void 1293; 1294; GCN-LABEL: @test_print_string_literal_size9( 1295; GCN-NEXT: entry: 1296; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 20) 1297; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1298; GCN: entry.split: 1299; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1300; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1301; GCN: 1: 1302; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1303; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1304; GCN-NEXT: store i32 36, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1305; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1306; GCN-NEXT: store i32 1684104548, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1307; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1308; GCN-NEXT: store i32 1717921122, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1309; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 4 1310; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 4 1311; GCN-NEXT: br label [[TMP2]] 1312; GCN: 2: 1313; GCN-NEXT: ret void 1314; 1315entry: 1316 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size9, i32 %n) 1317 ret void 1318} 1319 1320define amdgpu_kernel void @test_print_string_literal_size16(i32 %n) { 1321; R600-LABEL: @test_print_string_literal_size16( 1322; R600-NEXT: entry: 1323; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size16, i32 [[N:%.*]]) 1324; R600-NEXT: ret void 1325; 1326; GCN-LABEL: @test_print_string_literal_size16( 1327; GCN-NEXT: entry: 1328; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 24) 1329; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1330; GCN: entry.split: 1331; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1332; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1333; GCN: 1: 1334; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1335; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1336; GCN-NEXT: store i32 37, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1337; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1338; GCN-NEXT: store i32 909194801, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1339; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1340; GCN-NEXT: store i32 909194801, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1341; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 4 1342; GCN-NEXT: store i32 909194801, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 4 1343; GCN-NEXT: [[PRINTBUFFNEXTPTR2:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], i32 4 1344; GCN-NEXT: store i32 3225137, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], align 4 1345; GCN-NEXT: [[PRINTBUFFNEXTPTR3:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], i32 4 1346; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], align 4 1347; GCN-NEXT: br label [[TMP2]] 1348; GCN: 2: 1349; GCN-NEXT: ret void 1350; 1351entry: 1352 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size16, i32 %n) 1353 ret void 1354} 1355 1356define amdgpu_kernel void @test_print_string_literal_size17(i32 %n) { 1357; R600-LABEL: @test_print_string_literal_size17( 1358; R600-NEXT: entry: 1359; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size17, i32 [[N:%.*]]) 1360; R600-NEXT: ret void 1361; 1362; GCN-LABEL: @test_print_string_literal_size17( 1363; GCN-NEXT: entry: 1364; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 28) 1365; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1366; GCN: entry.split: 1367; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1368; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1369; GCN: 1: 1370; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1371; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1372; GCN-NEXT: store i32 38, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1373; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1374; GCN-NEXT: store i32 925972273, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1375; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1376; GCN-NEXT: store i32 925972273, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1377; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 4 1378; GCN-NEXT: store i32 925972273, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 4 1379; GCN-NEXT: [[PRINTBUFFNEXTPTR2:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], i32 4 1380; GCN-NEXT: store i32 925972273, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], align 4 1381; GCN-NEXT: [[PRINTBUFFNEXTPTR3:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], i32 4 1382; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], align 4 1383; GCN-NEXT: br label [[TMP2]] 1384; GCN: 2: 1385; GCN-NEXT: ret void 1386; 1387entry: 1388 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size17, i32 %n) 1389 ret void 1390} 1391 1392define amdgpu_kernel void @test_print_string_literal_size20(i32 %n) { 1393; R600-LABEL: @test_print_string_literal_size20( 1394; R600-NEXT: entry: 1395; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size20, i32 [[N:%.*]]) 1396; R600-NEXT: ret void 1397; 1398; GCN-LABEL: @test_print_string_literal_size20( 1399; GCN-NEXT: entry: 1400; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 28) 1401; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1402; GCN: entry.split: 1403; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1404; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1405; GCN: 1: 1406; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1407; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1408; GCN-NEXT: store i32 39, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1409; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1410; GCN-NEXT: store i32 1684234849, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1411; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1412; GCN-NEXT: store i32 1751606885, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1413; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 4 1414; GCN-NEXT: store i32 1818978921, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 4 1415; GCN-NEXT: [[PRINTBUFFNEXTPTR2:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], i32 4 1416; GCN-NEXT: store i32 1886350957, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], align 4 1417; GCN-NEXT: [[PRINTBUFFNEXTPTR3:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], i32 4 1418; GCN-NEXT: store i32 7565937, ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], align 4 1419; GCN-NEXT: [[PRINTBUFFNEXTPTR4:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], i32 4 1420; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], align 4 1421; GCN-NEXT: br label [[TMP2]] 1422; GCN: 2: 1423; GCN-NEXT: ret void 1424; 1425entry: 1426 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size20, i32 %n) 1427 ret void 1428} 1429 1430define amdgpu_kernel void @test_print_string_literal_size32(i32 %n) { 1431; R600-LABEL: @test_print_string_literal_size32( 1432; R600-NEXT: entry: 1433; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size32, i32 [[N:%.*]]) 1434; R600-NEXT: ret void 1435; 1436; GCN-LABEL: @test_print_string_literal_size32( 1437; GCN-NEXT: entry: 1438; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 40) 1439; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1440; GCN: entry.split: 1441; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1442; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1443; GCN: 1: 1444; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1445; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1446; GCN-NEXT: store i32 40, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1447; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1448; GCN-NEXT: store i32 1953722977, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1449; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1450; GCN-NEXT: store i32 1953722977, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1451; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 4 1452; GCN-NEXT: store i32 1953722977, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 4 1453; GCN-NEXT: [[PRINTBUFFNEXTPTR2:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], i32 4 1454; GCN-NEXT: store i32 1953722977, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], align 4 1455; GCN-NEXT: [[PRINTBUFFNEXTPTR3:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], i32 4 1456; GCN-NEXT: store i32 1953722977, ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], align 4 1457; GCN-NEXT: [[PRINTBUFFNEXTPTR4:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], i32 4 1458; GCN-NEXT: store i32 1953722977, ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], align 4 1459; GCN-NEXT: [[PRINTBUFFNEXTPTR5:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR4]], i32 4 1460; GCN-NEXT: store i32 1953722977, ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], align 4 1461; GCN-NEXT: [[PRINTBUFFNEXTPTR6:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR5]], i32 4 1462; GCN-NEXT: store i32 7565921, ptr addrspace(1) [[PRINTBUFFNEXTPTR6]], align 4 1463; GCN-NEXT: [[PRINTBUFFNEXTPTR7:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR6]], i32 4 1464; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR7]], align 4 1465; GCN-NEXT: br label [[TMP2]] 1466; GCN: 2: 1467; GCN-NEXT: ret void 1468; 1469entry: 1470 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.size32, i32 %n) 1471 ret void 1472} 1473 1474define amdgpu_kernel void @test_print_string_not_constant_global(i32 %n) { 1475; R600-LABEL: @test_print_string_not_constant_global( 1476; R600-NEXT: entry: 1477; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.not.constant.size4, i32 [[N:%.*]]) 1478; R600-NEXT: ret void 1479; 1480; GCN-LABEL: @test_print_string_not_constant_global( 1481; GCN-NEXT: entry: 1482; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1483; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1484; GCN: entry.split: 1485; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1486; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1487; GCN: 1: 1488; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1489; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1490; GCN-NEXT: store i32 41, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1491; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1492; GCN-NEXT: store i32 4144959, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1493; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1494; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1495; GCN-NEXT: br label [[TMP2]] 1496; GCN: 2: 1497; GCN-NEXT: ret void 1498; 1499entry: 1500 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.not.constant.size4, i32 %n) 1501 ret void 1502} 1503 1504define amdgpu_kernel void @test_print_string_constant_interposable_global(i32 %n) { 1505; R600-LABEL: @test_print_string_constant_interposable_global( 1506; R600-NEXT: entry: 1507; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.interposable.size4, i32 [[N:%.*]]) 1508; R600-NEXT: ret void 1509; 1510; GCN-LABEL: @test_print_string_constant_interposable_global( 1511; GCN-NEXT: entry: 1512; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1513; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1514; GCN: entry.split: 1515; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1516; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1517; GCN: 1: 1518; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1519; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1520; GCN-NEXT: store i32 42, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1521; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1522; GCN-NEXT: store i32 4144959, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1523; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1524; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1525; GCN-NEXT: br label [[TMP2]] 1526; GCN: 2: 1527; GCN-NEXT: ret void 1528; 1529entry: 1530 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.interposable.size4, i32 %n) 1531 ret void 1532} 1533 1534define amdgpu_kernel void @test_print_string_literal_v4i8(i32 %n) { 1535; R600-LABEL: @test_print_string_literal_v4i8( 1536; R600-NEXT: entry: 1537; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.v4i8, i32 [[N:%.*]]) 1538; R600-NEXT: ret void 1539; 1540; GCN-LABEL: @test_print_string_literal_v4i8( 1541; GCN-NEXT: entry: 1542; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 16) 1543; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1544; GCN: entry.split: 1545; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1546; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1547; GCN: 1: 1548; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1549; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1550; GCN-NEXT: store i32 43, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1551; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1552; GCN-NEXT: store i32 67305985, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1553; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1554; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1555; GCN-NEXT: br label [[TMP2]] 1556; GCN: 2: 1557; GCN-NEXT: ret void 1558; 1559entry: 1560 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.v4i8, i32 %n) 1561 ret void 1562} 1563 1564define amdgpu_kernel void @test_print_string_literal_v4i32(i32 %n) { 1565; R600-LABEL: @test_print_string_literal_v4i32( 1566; R600-NEXT: entry: 1567; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.v4i32, i32 [[N:%.*]]) 1568; R600-NEXT: ret void 1569; 1570; GCN-LABEL: @test_print_string_literal_v4i32( 1571; GCN-NEXT: entry: 1572; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1573; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1574; GCN: entry.split: 1575; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1576; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1577; GCN: 1: 1578; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1579; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1580; GCN-NEXT: store i32 44, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1581; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1582; GCN-NEXT: store i32 1, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1583; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1584; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1585; GCN-NEXT: br label [[TMP2]] 1586; GCN: 2: 1587; GCN-NEXT: ret void 1588; 1589entry: 1590 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.v4i32, i32 %n) 1591 ret void 1592} 1593 1594define amdgpu_kernel void @test_print_string_literal_struct(i32 %n) { 1595; R600-LABEL: @test_print_string_literal_struct( 1596; R600-NEXT: entry: 1597; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.struct, i32 [[N:%.*]]) 1598; R600-NEXT: ret void 1599; 1600; GCN-LABEL: @test_print_string_literal_struct( 1601; GCN-NEXT: entry: 1602; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1603; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1604; GCN: entry.split: 1605; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1606; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1607; GCN: 1: 1608; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1609; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1610; GCN-NEXT: store i32 45, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1611; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1612; GCN-NEXT: store i32 66, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1613; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1614; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1615; GCN-NEXT: br label [[TMP2]] 1616; GCN: 2: 1617; GCN-NEXT: ret void 1618; 1619entry: 1620 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.struct, i32 %n) 1621 ret void 1622} 1623 1624define amdgpu_kernel void @test_print_string_undef(i32 %n) { 1625; R600-LABEL: @test_print_string_undef( 1626; R600-NEXT: entry: 1627; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) undef, i32 [[N:%.*]]) 1628; R600-NEXT: ret void 1629; 1630; GCN-LABEL: @test_print_string_undef( 1631; GCN-NEXT: entry: 1632; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1633; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1634; GCN: entry.split: 1635; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1636; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1637; GCN: 1: 1638; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1639; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1640; GCN-NEXT: store i32 46, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1641; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1642; GCN-NEXT: store i32 4144959, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1643; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1644; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1645; GCN-NEXT: br label [[TMP2]] 1646; GCN: 2: 1647; GCN-NEXT: ret void 1648; 1649entry: 1650 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) undef, i32 %n) 1651 ret void 1652} 1653 1654define amdgpu_kernel void @test_print_string_poison(i32 %n) { 1655; R600-LABEL: @test_print_string_poison( 1656; R600-NEXT: entry: 1657; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) poison, i32 [[N:%.*]]) 1658; R600-NEXT: ret void 1659; 1660; GCN-LABEL: @test_print_string_poison( 1661; GCN-NEXT: entry: 1662; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1663; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1664; GCN: entry.split: 1665; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1666; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1667; GCN: 1: 1668; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1669; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1670; GCN-NEXT: store i32 47, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1671; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1672; GCN-NEXT: store i32 4144959, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1673; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1674; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1675; GCN-NEXT: br label [[TMP2]] 1676; GCN: 2: 1677; GCN-NEXT: ret void 1678; 1679entry: 1680 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) poison, i32 %n) 1681 ret void 1682} 1683 1684define amdgpu_kernel void @test_print_string_null(i32 %n) { 1685; R600-LABEL: @test_print_string_null( 1686; R600-NEXT: entry: 1687; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) null, i32 [[N:%.*]]) 1688; R600-NEXT: ret void 1689; 1690; GCN-LABEL: @test_print_string_null( 1691; GCN-NEXT: entry: 1692; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1693; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1694; GCN: entry.split: 1695; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1696; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1697; GCN: 1: 1698; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1699; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1700; GCN-NEXT: store i32 48, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1701; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1702; GCN-NEXT: store i32 4144959, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1703; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1704; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1705; GCN-NEXT: br label [[TMP2]] 1706; GCN: 2: 1707; GCN-NEXT: ret void 1708; 1709entry: 1710 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) null, i32 %n) 1711 ret void 1712} 1713 1714define amdgpu_kernel void @test_print_string_inttoptr(i32 %n) { 1715; R600-LABEL: @test_print_string_inttoptr( 1716; R600-NEXT: entry: 1717; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) inttoptr (i64 1234 to ptr addrspace(4)), i32 [[N:%.*]]) 1718; R600-NEXT: ret void 1719; 1720; GCN-LABEL: @test_print_string_inttoptr( 1721; GCN-NEXT: entry: 1722; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1723; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1724; GCN: entry.split: 1725; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1726; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1727; GCN: 1: 1728; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1729; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1730; GCN-NEXT: store i32 49, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1731; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1732; GCN-NEXT: store i32 4144959, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1733; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1734; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1735; GCN-NEXT: br label [[TMP2]] 1736; GCN: 2: 1737; GCN-NEXT: ret void 1738; 1739entry: 1740 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) inttoptr (i64 1234 to ptr addrspace(4)), i32 %n) 1741 ret void 1742} 1743 1744define amdgpu_kernel void @test_print_string_float_neg0(i32 %n) { 1745; R600-LABEL: @test_print_string_float_neg0( 1746; R600-NEXT: entry: 1747; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.float.0, i32 [[N:%.*]]) 1748; R600-NEXT: ret void 1749; 1750; GCN-LABEL: @test_print_string_float_neg0( 1751; GCN-NEXT: entry: 1752; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1753; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1754; GCN: entry.split: 1755; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1756; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1757; GCN: 1: 1758; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1759; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1760; GCN-NEXT: store i32 50, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1761; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1762; GCN-NEXT: store i32 -256, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1763; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1764; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1765; GCN-NEXT: br label [[TMP2]] 1766; GCN: 2: 1767; GCN-NEXT: ret void 1768; 1769entry: 1770 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.float.0, i32 %n) 1771 ret void 1772} 1773 1774define amdgpu_kernel void @test_print_string_float_0(i32 %n) { 1775; R600-LABEL: @test_print_string_float_0( 1776; R600-NEXT: entry: 1777; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.float.0, i32 [[N:%.*]]) 1778; R600-NEXT: ret void 1779; 1780; GCN-LABEL: @test_print_string_float_0( 1781; GCN-NEXT: entry: 1782; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1783; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1784; GCN: entry.split: 1785; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1786; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1787; GCN: 1: 1788; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1789; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1790; GCN-NEXT: store i32 51, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1791; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1792; GCN-NEXT: store i32 -256, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1793; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1794; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1795; GCN-NEXT: br label [[TMP2]] 1796; GCN: 2: 1797; GCN-NEXT: ret void 1798; 1799entry: 1800 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.float.0, i32 %n) 1801 ret void 1802} 1803 1804define amdgpu_kernel void @test_print_string_ptr_null(i32 %n) { 1805; R600-LABEL: @test_print_string_ptr_null( 1806; R600-NEXT: entry: 1807; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.ptr.null, i32 [[N:%.*]]) 1808; R600-NEXT: ret void 1809; 1810; GCN-LABEL: @test_print_string_ptr_null( 1811; GCN-NEXT: entry: 1812; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1813; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1814; GCN: entry.split: 1815; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1816; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1817; GCN: 1: 1818; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1819; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1820; GCN-NEXT: store i32 52, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1821; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1822; GCN-NEXT: store i32 -256, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1823; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1824; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1825; GCN-NEXT: br label [[TMP2]] 1826; GCN: 2: 1827; GCN-NEXT: ret void 1828; 1829entry: 1830 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.ptr.null, i32 %n) 1831 ret void 1832} 1833 1834define amdgpu_kernel void @test_print_string_ptr_undef(i32 %n) { 1835; R600-LABEL: @test_print_string_ptr_undef( 1836; R600-NEXT: entry: 1837; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.ptr.undef, i32 [[N:%.*]]) 1838; R600-NEXT: ret void 1839; 1840; GCN-LABEL: @test_print_string_ptr_undef( 1841; GCN-NEXT: entry: 1842; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1843; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1844; GCN: entry.split: 1845; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1846; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1847; GCN: 1: 1848; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1849; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1850; GCN-NEXT: store i32 53, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1851; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1852; GCN-NEXT: store i32 -256, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1853; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1854; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1855; GCN-NEXT: br label [[TMP2]] 1856; GCN: 2: 1857; GCN-NEXT: ret void 1858; 1859entry: 1860 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) @printed.str.ptr.undef, i32 %n) 1861 ret void 1862} 1863 1864define amdgpu_kernel void @test_print_string_indexed(i32 %n) { 1865; R600-LABEL: @test_print_string_indexed( 1866; R600-NEXT: entry: 1867; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) getelementptr ([32 x i8], ptr addrspace(4) @printed.str.size32, i64 0, i64 15), i32 [[N:%.*]]) 1868; R600-NEXT: ret void 1869; 1870; GCN-LABEL: @test_print_string_indexed( 1871; GCN-NEXT: entry: 1872; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 28) 1873; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1874; GCN: entry.split: 1875; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1876; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1877; GCN: 1: 1878; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1879; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1880; GCN-NEXT: store i32 54, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1881; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1882; GCN-NEXT: store i32 1936875892, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1883; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1884; GCN-NEXT: store i32 1936875892, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1885; GCN-NEXT: [[PRINTBUFFNEXTPTR1:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR]], i32 4 1886; GCN-NEXT: store i32 1936875892, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], align 4 1887; GCN-NEXT: [[PRINTBUFFNEXTPTR2:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR1]], i32 4 1888; GCN-NEXT: store i32 1936875892, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], align 4 1889; GCN-NEXT: [[PRINTBUFFNEXTPTR3:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFNEXTPTR2]], i32 4 1890; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR3]], align 4 1891; GCN-NEXT: br label [[TMP2]] 1892; GCN: 2: 1893; GCN-NEXT: ret void 1894; 1895entry: 1896 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) getelementptr ([32 x i8], ptr addrspace(4) @printed.str.size32, i64 0, i64 15), i32 %n) 1897 ret void 1898} 1899 1900define amdgpu_kernel void @test_print_string_indexed_oob(i32 %n) { 1901; R600-LABEL: @test_print_string_indexed_oob( 1902; R600-NEXT: entry: 1903; R600-NEXT: [[PRINTF:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) getelementptr ([32 x i8], ptr addrspace(4) @printed.str.size32, i64 0, i64 32), i32 [[N:%.*]]) 1904; R600-NEXT: ret void 1905; 1906; GCN-LABEL: @test_print_string_indexed_oob( 1907; GCN-NEXT: entry: 1908; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 1909; GCN-NEXT: br label [[ENTRY_SPLIT:%.*]] 1910; GCN: entry.split: 1911; GCN-NEXT: [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1912; GCN-NEXT: br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]] 1913; GCN: 1: 1914; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1915; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1916; GCN-NEXT: store i32 55, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1917; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1918; GCN-NEXT: store i32 -256, ptr addrspace(1) [[PRINTBUFFGEP]], align 4 1919; GCN-NEXT: [[PRINTBUFFNEXTPTR:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTBUFFGEP]], i32 4 1920; GCN-NEXT: store i32 [[N:%.*]], ptr addrspace(1) [[PRINTBUFFNEXTPTR]], align 4 1921; GCN-NEXT: br label [[TMP2]] 1922; GCN: 2: 1923; GCN-NEXT: ret void 1924; 1925entry: 1926 %printf = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @.str, ptr addrspace(4) getelementptr ([32 x i8], ptr addrspace(4) @printed.str.size32, i64 0, i64 32), i32 %n) 1927 ret void 1928} 1929 1930@array.i16 = private unnamed_addr addrspace(4) constant [6 x i16] [i16 1, i16 2, i16 3, i16 4, i16 5, i16 6] 1931 1932; CHECK: error: <unknown>:0:0: in function test_format_array_i16 void (i32): printf format string must be a trivially resolved constant string global variable 1933define amdgpu_kernel void @test_format_array_i16(i32 %n) { 1934; R600-LABEL: @test_format_array_i16( 1935; R600-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 1936; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @array.i16, ptr addrspace(5) [[STR]], i32 [[N:%.*]]) 1937; R600-NEXT: ret void 1938; 1939; GCN-LABEL: @test_format_array_i16( 1940; GCN-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 1941; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 4) 1942; GCN-NEXT: br label [[DOTSPLIT:%.*]] 1943; GCN: .split: 1944; GCN-NEXT: [[TMP1:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1945; GCN-NEXT: br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP3:%.*]] 1946; GCN: 2: 1947; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1948; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1949; GCN-NEXT: store i32 56, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1950; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1951; GCN-NEXT: br label [[TMP3]] 1952; GCN: 3: 1953; GCN-NEXT: ret void 1954; 1955 %str = alloca [9 x i8], align 1, addrspace(5) 1956 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @array.i16, ptr addrspace(5) %str, i32 %n) 1957 ret void 1958} 1959 1960@struct = private unnamed_addr addrspace(4) constant { [6 x i8] } { [6 x i8] [i8 1, i8 2, i8 3, i8 4, i8 5, i8 6] } 1961 1962define amdgpu_kernel void @test_format_struct(i32 %n) { 1963; R600-LABEL: @test_format_struct( 1964; R600-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 1965; R600-NEXT: [[CALL1:%.*]] = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @struct, ptr addrspace(5) [[STR]], i32 [[N:%.*]]) 1966; R600-NEXT: ret void 1967; 1968; GCN-LABEL: @test_format_struct( 1969; GCN-NEXT: [[STR:%.*]] = alloca [9 x i8], align 1, addrspace(5) 1970; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 4) 1971; GCN-NEXT: br label [[DOTSPLIT:%.*]] 1972; GCN: .split: 1973; GCN-NEXT: [[TMP1:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 1974; GCN-NEXT: br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP3:%.*]] 1975; GCN: 2: 1976; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 1977; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 1978; GCN-NEXT: store i32 57, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 1979; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 1980; GCN-NEXT: br label [[TMP3]] 1981; GCN: 3: 1982; GCN-NEXT: ret void 1983; 1984 %str = alloca [9 x i8], align 1, addrspace(5) 1985 %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @struct, ptr addrspace(5) %str, i32 %n) 1986 ret void 1987} 1988 1989declare void @func(ptr) 1990 1991define void @not_call_operand_printf() { 1992; R600-LABEL: @not_call_operand_printf( 1993; R600-NEXT: call void @func(ptr @printf) 1994; R600-NEXT: ret void 1995; 1996; GCN-LABEL: @not_call_operand_printf( 1997; GCN-NEXT: call void @func(ptr @printf) 1998; GCN-NEXT: ret void 1999; 2000 call void @func(ptr @printf) 2001 ret void 2002} 2003 2004define void @printf_printf(i32 %n) { 2005; R600-LABEL: @printf_printf( 2006; R600-NEXT: [[CALL:%.*]] = call i32 @printf(ptr addrspace(4) @format.str.one.ptr, ptr @printf) 2007; R600-NEXT: ret void 2008; 2009; GCN-LABEL: @printf_printf( 2010; GCN-NEXT: [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 12) 2011; GCN-NEXT: br label [[DOTSPLIT:%.*]] 2012; GCN: .split: 2013; GCN-NEXT: [[TMP1:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null 2014; GCN-NEXT: br i1 [[TMP1]], label [[TMP2:%.*]], label [[TMP3:%.*]] 2015; GCN: 2: 2016; GCN-NEXT: [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 0 2017; GCN-NEXT: [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1) 2018; GCN-NEXT: store i32 58, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 4 2019; GCN-NEXT: [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 4 2020; GCN-NEXT: store ptr @printf, ptr addrspace(1) [[PRINTBUFFGEP]], align 8 2021; GCN-NEXT: br label [[TMP3]] 2022; GCN: 3: 2023; GCN-NEXT: ret void 2024; 2025 %call = call i32 @printf(ptr addrspace(4) @format.str.one.ptr, ptr @printf) 2026 ret void 2027} 2028 2029declare i32 @printf(ptr addrspace(4), ...) 2030