1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2 2; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes=amdgpu-simplifylib %s | FileCheck %s 3 4target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9" 5 6declare <2 x float> @_Z4fmaxDv2_ff(<2 x float>, float) 7declare <2 x float> @_Z4fmaxDv2_fS_(<2 x float>, <2 x float>) 8declare <3 x float> @_Z4fmaxDv3_ff(<3 x float>, float) 9declare <3 x float> @_Z4fmaxDv3_fS_(<3 x float>, <3 x float>) 10declare <4 x float> @_Z4fmaxDv4_ff(<4 x float>, float) 11declare <4 x float> @_Z4fmaxDv4_fS_(<4 x float>, <4 x float>) 12declare <8 x float> @_Z4fmaxDv8_ff(<8 x float>, float) 13declare <8 x float> @_Z4fmaxDv8_fS_(<8 x float>, <8 x float>) 14declare <16 x float> @_Z4fmaxDv16_ff(<16 x float>, float) 15declare <16 x float> @_Z4fmaxDv16_fS_(<16 x float>, <16 x float>) 16declare <2 x double> @_Z4fmaxDv2_dd(<2 x double>, double) 17declare <2 x double> @_Z4fmaxDv2_dS_(<2 x double>, <2 x double>) 18declare <3 x double> @_Z4fmaxDv3_dd(<3 x double>, double) 19declare <3 x double> @_Z4fmaxDv3_dS_(<3 x double>, <3 x double>) 20declare <4 x double> @_Z4fmaxDv4_dd(<4 x double>, double) 21declare <4 x double> @_Z4fmaxDv4_dS_(<4 x double>, <4 x double>) 22declare <8 x double> @_Z4fmaxDv8_dd(<8 x double>, double) 23declare <8 x double> @_Z4fmaxDv8_dS_(<8 x double>, <8 x double>) 24declare <16 x double> @_Z4fmaxDv16_dd(<16 x double>, double) 25declare <16 x double> @_Z4fmaxDv16_dS_(<16 x double>, <16 x double>) 26declare <2 x half> @_Z4fmaxDv2_DhDh(<2 x half>, half) 27declare <2 x half> @_Z4fmaxDv2_DhS_(<2 x half>, <2 x half>) 28declare <3 x half> @_Z4fmaxDv3_DhDh(<3 x half>, half) 29declare <3 x half> @_Z4fmaxDv3_DhS_(<3 x half>, <3 x half>) 30declare <4 x half> @_Z4fmaxDv4_DhDh(<4 x half>, half) 31declare <4 x half> @_Z4fmaxDv4_DhS_(<4 x half>, <4 x half>) 32declare <8 x half> @_Z4fmaxDv8_DhDh(<8 x half>, half) 33declare <8 x half> @_Z4fmaxDv8_DhS_(<8 x half>, <8 x half>) 34declare <16 x half> @_Z4fmaxDv16_DhDh(<16 x half>, half) 35declare <16 x half> @_Z4fmaxDv16_DhS_(<16 x half>, <16 x half>) 36 37define <2 x float> @test_fmax_v2f32_f32(<2 x float> %x, float %y) { 38; CHECK-LABEL: define <2 x float> @test_fmax_v2f32_f32 39; CHECK-SAME: (<2 x float> [[X:%.*]], float [[Y:%.*]]) { 40; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <2 x float> poison, float [[Y]], i64 0 41; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <2 x float> [[DOTSPLATINSERT]], <2 x float> poison, <2 x i32> zeroinitializer 42; CHECK-NEXT: [[MIN:%.*]] = tail call <2 x float> @llvm.maxnum.v2f32(<2 x float> [[X]], <2 x float> [[DOTSPLAT]]) 43; CHECK-NEXT: ret <2 x float> [[MIN]] 44; 45 %min = tail call <2 x float> @_Z4fmaxDv2_ff(<2 x float> %x, float %y) 46 ret <2 x float> %min 47} 48 49define <2 x float> @test_fmax_f32_v2f32(float %x, <2 x float> %y) { 50; CHECK-LABEL: define <2 x float> @test_fmax_f32_v2f32 51; CHECK-SAME: (float [[X:%.*]], <2 x float> [[Y:%.*]]) { 52; CHECK-NEXT: [[INSERT:%.*]] = insertelement <2 x float> poison, float [[X]], i64 0 53; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <2 x float> [[INSERT]], <2 x float> poison, <2 x i32> zeroinitializer 54; CHECK-NEXT: [[MIN:%.*]] = tail call <2 x float> @llvm.maxnum.v2f32(<2 x float> [[SHUFFLE]], <2 x float> [[Y]]) 55; CHECK-NEXT: ret <2 x float> [[MIN]] 56; 57 %insert = insertelement <2 x float> poison, float %x, i64 0 58 %shuffle = shufflevector <2 x float> %insert, <2 x float> poison, <2 x i32> zeroinitializer 59 %min = tail call <2 x float> @_Z4fmaxDv2_fS_(<2 x float> %shuffle, <2 x float> %y) 60 ret <2 x float> %min 61} 62 63define <3 x float> @test_fmax_v3f32_f32(<3 x float> %x, float %y) { 64; CHECK-LABEL: define <3 x float> @test_fmax_v3f32_f32 65; CHECK-SAME: (<3 x float> [[X:%.*]], float [[Y:%.*]]) { 66; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <3 x float> poison, float [[Y]], i64 0 67; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <3 x float> [[DOTSPLATINSERT]], <3 x float> poison, <3 x i32> zeroinitializer 68; CHECK-NEXT: [[MIN:%.*]] = tail call <3 x float> @llvm.maxnum.v3f32(<3 x float> [[X]], <3 x float> [[DOTSPLAT]]) 69; CHECK-NEXT: ret <3 x float> [[MIN]] 70; 71 %min = tail call <3 x float> @_Z4fmaxDv3_ff(<3 x float> %x, float %y) 72 ret <3 x float> %min 73} 74 75define <3 x float> @test_fmax_f32_v3f32(float %x, <3 x float> %y) { 76; CHECK-LABEL: define <3 x float> @test_fmax_f32_v3f32 77; CHECK-SAME: (float [[X:%.*]], <3 x float> [[Y:%.*]]) { 78; CHECK-NEXT: [[INSERT:%.*]] = insertelement <3 x float> poison, float [[X]], i64 0 79; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <3 x float> [[INSERT]], <3 x float> poison, <3 x i32> zeroinitializer 80; CHECK-NEXT: [[MIN:%.*]] = tail call <3 x float> @llvm.maxnum.v3f32(<3 x float> [[SHUFFLE]], <3 x float> [[Y]]) 81; CHECK-NEXT: ret <3 x float> [[MIN]] 82; 83 %insert = insertelement <3 x float> poison, float %x, i64 0 84 %shuffle = shufflevector <3 x float> %insert, <3 x float> poison, <3 x i32> zeroinitializer 85 %min = tail call <3 x float> @_Z4fmaxDv3_fS_(<3 x float> %shuffle, <3 x float> %y) 86 ret <3 x float> %min 87} 88 89define <4 x float> @test_fmax_v4f32_f32(<4 x float> %x, float %y) { 90; CHECK-LABEL: define <4 x float> @test_fmax_v4f32_f32 91; CHECK-SAME: (<4 x float> [[X:%.*]], float [[Y:%.*]]) { 92; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x float> poison, float [[Y]], i64 0 93; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT]], <4 x float> poison, <4 x i32> zeroinitializer 94; CHECK-NEXT: [[MIN:%.*]] = tail call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[X]], <4 x float> [[DOTSPLAT]]) 95; CHECK-NEXT: ret <4 x float> [[MIN]] 96; 97 %min = tail call <4 x float> @_Z4fmaxDv4_ff(<4 x float> %x, float %y) 98 ret <4 x float> %min 99} 100 101define <4 x float> @test_fmax_f32_v4f32(float %x, <4 x float> %y) { 102; CHECK-LABEL: define <4 x float> @test_fmax_f32_v4f32 103; CHECK-SAME: (float [[X:%.*]], <4 x float> [[Y:%.*]]) { 104; CHECK-NEXT: [[INSERT:%.*]] = insertelement <4 x float> poison, float [[X]], i64 0 105; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <4 x float> [[INSERT]], <4 x float> poison, <4 x i32> zeroinitializer 106; CHECK-NEXT: [[MIN:%.*]] = tail call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[SHUFFLE]], <4 x float> [[Y]]) 107; CHECK-NEXT: ret <4 x float> [[MIN]] 108; 109 %insert = insertelement <4 x float> poison, float %x, i64 0 110 %shuffle = shufflevector <4 x float> %insert, <4 x float> poison, <4 x i32> zeroinitializer 111 %min = tail call <4 x float> @_Z4fmaxDv4_fS_(<4 x float> %shuffle, <4 x float> %y) 112 ret <4 x float> %min 113} 114 115define <8 x float> @test_fmax_v8f32_f32(<8 x float> %x, float %y) { 116; CHECK-LABEL: define <8 x float> @test_fmax_v8f32_f32 117; CHECK-SAME: (<8 x float> [[X:%.*]], float [[Y:%.*]]) { 118; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <8 x float> poison, float [[Y]], i64 0 119; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x float> [[DOTSPLATINSERT]], <8 x float> poison, <8 x i32> zeroinitializer 120; CHECK-NEXT: [[MIN:%.*]] = tail call <8 x float> @llvm.maxnum.v8f32(<8 x float> [[X]], <8 x float> [[DOTSPLAT]]) 121; CHECK-NEXT: ret <8 x float> [[MIN]] 122; 123 %min = tail call <8 x float> @_Z4fmaxDv8_ff(<8 x float> %x, float %y) 124 ret <8 x float> %min 125} 126 127define <8 x float> @test_fmax_f32_v8f32(float %x, <8 x float> %y) { 128; CHECK-LABEL: define <8 x float> @test_fmax_f32_v8f32 129; CHECK-SAME: (float [[X:%.*]], <8 x float> [[Y:%.*]]) { 130; CHECK-NEXT: [[INSERT:%.*]] = insertelement <8 x float> poison, float [[X]], i64 0 131; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <8 x float> [[INSERT]], <8 x float> poison, <8 x i32> zeroinitializer 132; CHECK-NEXT: [[MIN:%.*]] = tail call <8 x float> @llvm.maxnum.v8f32(<8 x float> [[SHUFFLE]], <8 x float> [[Y]]) 133; CHECK-NEXT: ret <8 x float> [[MIN]] 134; 135 %insert = insertelement <8 x float> poison, float %x, i64 0 136 %shuffle = shufflevector <8 x float> %insert, <8 x float> poison, <8 x i32> zeroinitializer 137 %min = tail call <8 x float> @_Z4fmaxDv8_fS_(<8 x float> %shuffle, <8 x float> %y) 138 ret <8 x float> %min 139} 140 141define <16 x float> @test_fmax_v16f32_f32(<16 x float> %x, float %y) { 142; CHECK-LABEL: define <16 x float> @test_fmax_v16f32_f32 143; CHECK-SAME: (<16 x float> [[X:%.*]], float [[Y:%.*]]) { 144; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <16 x float> poison, float [[Y]], i64 0 145; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <16 x float> [[DOTSPLATINSERT]], <16 x float> poison, <16 x i32> zeroinitializer 146; CHECK-NEXT: [[MIN:%.*]] = tail call <16 x float> @llvm.maxnum.v16f32(<16 x float> [[X]], <16 x float> [[DOTSPLAT]]) 147; CHECK-NEXT: ret <16 x float> [[MIN]] 148; 149 %min = tail call <16 x float> @_Z4fmaxDv16_ff(<16 x float> %x, float %y) 150 ret <16 x float> %min 151} 152 153define <16 x float> @test_fmax_f32_v16f32(float %x, <16 x float> %y) { 154; CHECK-LABEL: define <16 x float> @test_fmax_f32_v16f32 155; CHECK-SAME: (float [[X:%.*]], <16 x float> [[Y:%.*]]) { 156; CHECK-NEXT: [[INSERT:%.*]] = insertelement <16 x float> poison, float [[X]], i64 0 157; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <16 x float> [[INSERT]], <16 x float> poison, <16 x i32> zeroinitializer 158; CHECK-NEXT: [[MIN:%.*]] = tail call <16 x float> @llvm.maxnum.v16f32(<16 x float> [[SHUFFLE]], <16 x float> [[Y]]) 159; CHECK-NEXT: ret <16 x float> [[MIN]] 160; 161 %insert = insertelement <16 x float> poison, float %x, i64 0 162 %shuffle = shufflevector <16 x float> %insert, <16 x float> poison, <16 x i32> zeroinitializer 163 %min = tail call <16 x float> @_Z4fmaxDv16_fS_(<16 x float> %shuffle, <16 x float> %y) 164 ret <16 x float> %min 165} 166 167define <2 x double> @test_fmax_v2f64_f64(<2 x double> %x, double %y) { 168; CHECK-LABEL: define <2 x double> @test_fmax_v2f64_f64 169; CHECK-SAME: (<2 x double> [[X:%.*]], double [[Y:%.*]]) { 170; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <2 x double> poison, double [[Y]], i64 0 171; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <2 x double> [[DOTSPLATINSERT]], <2 x double> poison, <2 x i32> zeroinitializer 172; CHECK-NEXT: [[MIN:%.*]] = tail call <2 x double> @llvm.maxnum.v2f64(<2 x double> [[X]], <2 x double> [[DOTSPLAT]]) 173; CHECK-NEXT: ret <2 x double> [[MIN]] 174; 175 %min = tail call <2 x double> @_Z4fmaxDv2_dd(<2 x double> %x, double %y) 176 ret <2 x double> %min 177} 178 179define <2 x double> @test_fmax_f64_v2f64(double %x, <2 x double> %y) { 180; CHECK-LABEL: define <2 x double> @test_fmax_f64_v2f64 181; CHECK-SAME: (double [[X:%.*]], <2 x double> [[Y:%.*]]) { 182; CHECK-NEXT: [[INSERT:%.*]] = insertelement <2 x double> poison, double [[X]], i64 0 183; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <2 x double> [[INSERT]], <2 x double> poison, <2 x i32> zeroinitializer 184; CHECK-NEXT: [[MIN:%.*]] = tail call <2 x double> @llvm.maxnum.v2f64(<2 x double> [[SHUFFLE]], <2 x double> [[Y]]) 185; CHECK-NEXT: ret <2 x double> [[MIN]] 186; 187 %insert = insertelement <2 x double> poison, double %x, i64 0 188 %shuffle = shufflevector <2 x double> %insert, <2 x double> poison, <2 x i32> zeroinitializer 189 %min = tail call <2 x double> @_Z4fmaxDv2_dS_(<2 x double> %shuffle, <2 x double> %y) 190 ret <2 x double> %min 191} 192 193define <3 x double> @test_fmax_v3f64_f64(<3 x double> %x, double %y) { 194; CHECK-LABEL: define <3 x double> @test_fmax_v3f64_f64 195; CHECK-SAME: (<3 x double> [[X:%.*]], double [[Y:%.*]]) { 196; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <3 x double> poison, double [[Y]], i64 0 197; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <3 x double> [[DOTSPLATINSERT]], <3 x double> poison, <3 x i32> zeroinitializer 198; CHECK-NEXT: [[MIN:%.*]] = tail call <3 x double> @llvm.maxnum.v3f64(<3 x double> [[X]], <3 x double> [[DOTSPLAT]]) 199; CHECK-NEXT: ret <3 x double> [[MIN]] 200; 201 %min = tail call <3 x double> @_Z4fmaxDv3_dd(<3 x double> %x, double %y) 202 ret <3 x double> %min 203} 204 205define <3 x double> @test_fmax_f64_v3f64(double %x, <3 x double> %y) { 206; CHECK-LABEL: define <3 x double> @test_fmax_f64_v3f64 207; CHECK-SAME: (double [[X:%.*]], <3 x double> [[Y:%.*]]) { 208; CHECK-NEXT: [[INSERT:%.*]] = insertelement <3 x double> poison, double [[X]], i64 0 209; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <3 x double> [[INSERT]], <3 x double> poison, <3 x i32> zeroinitializer 210; CHECK-NEXT: [[MIN:%.*]] = tail call <3 x double> @llvm.maxnum.v3f64(<3 x double> [[SHUFFLE]], <3 x double> [[Y]]) 211; CHECK-NEXT: ret <3 x double> [[MIN]] 212; 213 %insert = insertelement <3 x double> poison, double %x, i64 0 214 %shuffle = shufflevector <3 x double> %insert, <3 x double> poison, <3 x i32> zeroinitializer 215 %min = tail call <3 x double> @_Z4fmaxDv3_dS_(<3 x double> %shuffle, <3 x double> %y) 216 ret <3 x double> %min 217} 218 219define <4 x double> @test_fmax_v4f64_f64(<4 x double> %x, double %y) { 220; CHECK-LABEL: define <4 x double> @test_fmax_v4f64_f64 221; CHECK-SAME: (<4 x double> [[X:%.*]], double [[Y:%.*]]) { 222; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x double> poison, double [[Y]], i64 0 223; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x double> [[DOTSPLATINSERT]], <4 x double> poison, <4 x i32> zeroinitializer 224; CHECK-NEXT: [[MIN:%.*]] = tail call <4 x double> @llvm.maxnum.v4f64(<4 x double> [[X]], <4 x double> [[DOTSPLAT]]) 225; CHECK-NEXT: ret <4 x double> [[MIN]] 226; 227 %min = tail call <4 x double> @_Z4fmaxDv4_dd(<4 x double> %x, double %y) 228 ret <4 x double> %min 229} 230 231define <4 x double> @test_fmax_f64_v4f64(double %x, <4 x double> %y) { 232; CHECK-LABEL: define <4 x double> @test_fmax_f64_v4f64 233; CHECK-SAME: (double [[X:%.*]], <4 x double> [[Y:%.*]]) { 234; CHECK-NEXT: [[INSERT:%.*]] = insertelement <4 x double> poison, double [[X]], i64 0 235; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <4 x double> [[INSERT]], <4 x double> poison, <4 x i32> zeroinitializer 236; CHECK-NEXT: [[MIN:%.*]] = tail call <4 x double> @llvm.maxnum.v4f64(<4 x double> [[SHUFFLE]], <4 x double> [[Y]]) 237; CHECK-NEXT: ret <4 x double> [[MIN]] 238; 239 %insert = insertelement <4 x double> poison, double %x, i64 0 240 %shuffle = shufflevector <4 x double> %insert, <4 x double> poison, <4 x i32> zeroinitializer 241 %min = tail call <4 x double> @_Z4fmaxDv4_dS_(<4 x double> %shuffle, <4 x double> %y) 242 ret <4 x double> %min 243} 244 245define <8 x double> @test_fmax_v8f64_f64(<8 x double> %x, double %y) { 246; CHECK-LABEL: define <8 x double> @test_fmax_v8f64_f64 247; CHECK-SAME: (<8 x double> [[X:%.*]], double [[Y:%.*]]) { 248; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <8 x double> poison, double [[Y]], i64 0 249; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x double> [[DOTSPLATINSERT]], <8 x double> poison, <8 x i32> zeroinitializer 250; CHECK-NEXT: [[MIN:%.*]] = tail call <8 x double> @llvm.maxnum.v8f64(<8 x double> [[X]], <8 x double> [[DOTSPLAT]]) 251; CHECK-NEXT: ret <8 x double> [[MIN]] 252; 253 %min = tail call <8 x double> @_Z4fmaxDv8_dd(<8 x double> %x, double %y) 254 ret <8 x double> %min 255} 256 257define <8 x double> @test_fmax_f64_v8f64(double %x, <8 x double> %y) { 258; CHECK-LABEL: define <8 x double> @test_fmax_f64_v8f64 259; CHECK-SAME: (double [[X:%.*]], <8 x double> [[Y:%.*]]) { 260; CHECK-NEXT: [[INSERT:%.*]] = insertelement <8 x double> poison, double [[X]], i64 0 261; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <8 x double> [[INSERT]], <8 x double> poison, <8 x i32> zeroinitializer 262; CHECK-NEXT: [[MIN:%.*]] = tail call <8 x double> @llvm.maxnum.v8f64(<8 x double> [[SHUFFLE]], <8 x double> [[Y]]) 263; CHECK-NEXT: ret <8 x double> [[MIN]] 264; 265 %insert = insertelement <8 x double> poison, double %x, i64 0 266 %shuffle = shufflevector <8 x double> %insert, <8 x double> poison, <8 x i32> zeroinitializer 267 %min = tail call <8 x double> @_Z4fmaxDv8_dS_(<8 x double> %shuffle, <8 x double> %y) 268 ret <8 x double> %min 269} 270 271define <16 x double> @test_fmax_v16f64_f64(<16 x double> %x, double %y) { 272; CHECK-LABEL: define <16 x double> @test_fmax_v16f64_f64 273; CHECK-SAME: (<16 x double> [[X:%.*]], double [[Y:%.*]]) { 274; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <16 x double> poison, double [[Y]], i64 0 275; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <16 x double> [[DOTSPLATINSERT]], <16 x double> poison, <16 x i32> zeroinitializer 276; CHECK-NEXT: [[MIN:%.*]] = tail call <16 x double> @llvm.maxnum.v16f64(<16 x double> [[X]], <16 x double> [[DOTSPLAT]]) 277; CHECK-NEXT: ret <16 x double> [[MIN]] 278; 279 %min = tail call <16 x double> @_Z4fmaxDv16_dd(<16 x double> %x, double %y) 280 ret <16 x double> %min 281} 282 283define <16 x double> @test_fmax_f64_v16f64(double %x, <16 x double> %y) { 284; CHECK-LABEL: define <16 x double> @test_fmax_f64_v16f64 285; CHECK-SAME: (double [[X:%.*]], <16 x double> [[Y:%.*]]) { 286; CHECK-NEXT: [[INSERT:%.*]] = insertelement <16 x double> poison, double [[X]], i64 0 287; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <16 x double> [[INSERT]], <16 x double> poison, <16 x i32> zeroinitializer 288; CHECK-NEXT: [[MIN:%.*]] = tail call <16 x double> @llvm.maxnum.v16f64(<16 x double> [[SHUFFLE]], <16 x double> [[Y]]) 289; CHECK-NEXT: ret <16 x double> [[MIN]] 290; 291 %insert = insertelement <16 x double> poison, double %x, i64 0 292 %shuffle = shufflevector <16 x double> %insert, <16 x double> poison, <16 x i32> zeroinitializer 293 %min = tail call <16 x double> @_Z4fmaxDv16_dS_(<16 x double> %shuffle, <16 x double> %y) 294 ret <16 x double> %min 295} 296 297define <2 x half> @test_fmax_v2f16_f16(<2 x half> %x, half %y) { 298; CHECK-LABEL: define <2 x half> @test_fmax_v2f16_f16 299; CHECK-SAME: (<2 x half> [[X:%.*]], half [[Y:%.*]]) { 300; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <2 x half> poison, half [[Y]], i64 0 301; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <2 x half> [[DOTSPLATINSERT]], <2 x half> poison, <2 x i32> zeroinitializer 302; CHECK-NEXT: [[MIN:%.*]] = tail call <2 x half> @llvm.maxnum.v2f16(<2 x half> [[X]], <2 x half> [[DOTSPLAT]]) 303; CHECK-NEXT: ret <2 x half> [[MIN]] 304; 305 %min = tail call <2 x half> @_Z4fmaxDv2_DhDh(<2 x half> %x, half %y) 306 ret <2 x half> %min 307} 308 309define <2 x half> @test_fmax_f16_v2f16(half %x, <2 x half> %y) { 310; CHECK-LABEL: define <2 x half> @test_fmax_f16_v2f16 311; CHECK-SAME: (half [[X:%.*]], <2 x half> [[Y:%.*]]) { 312; CHECK-NEXT: [[INSERT:%.*]] = insertelement <2 x half> poison, half [[X]], i64 0 313; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <2 x half> [[INSERT]], <2 x half> poison, <2 x i32> zeroinitializer 314; CHECK-NEXT: [[MIN:%.*]] = tail call <2 x half> @llvm.maxnum.v2f16(<2 x half> [[SHUFFLE]], <2 x half> [[Y]]) 315; CHECK-NEXT: ret <2 x half> [[MIN]] 316; 317 %insert = insertelement <2 x half> poison, half %x, i64 0 318 %shuffle = shufflevector <2 x half> %insert, <2 x half> poison, <2 x i32> zeroinitializer 319 %min = tail call <2 x half> @_Z4fmaxDv2_DhS_(<2 x half> %shuffle, <2 x half> %y) 320 ret <2 x half> %min 321} 322 323define <3 x half> @test_fmax_v3f16_f16(<3 x half> %x, half %y) { 324; CHECK-LABEL: define <3 x half> @test_fmax_v3f16_f16 325; CHECK-SAME: (<3 x half> [[X:%.*]], half [[Y:%.*]]) { 326; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <3 x half> poison, half [[Y]], i64 0 327; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <3 x half> [[DOTSPLATINSERT]], <3 x half> poison, <3 x i32> zeroinitializer 328; CHECK-NEXT: [[MIN:%.*]] = tail call <3 x half> @llvm.maxnum.v3f16(<3 x half> [[X]], <3 x half> [[DOTSPLAT]]) 329; CHECK-NEXT: ret <3 x half> [[MIN]] 330; 331 %min = tail call <3 x half> @_Z4fmaxDv3_DhDh(<3 x half> %x, half %y) 332 ret <3 x half> %min 333} 334 335define <3 x half> @test_fmax_f16_v3f16(half %x, <3 x half> %y) { 336; CHECK-LABEL: define <3 x half> @test_fmax_f16_v3f16 337; CHECK-SAME: (half [[X:%.*]], <3 x half> [[Y:%.*]]) { 338; CHECK-NEXT: [[INSERT:%.*]] = insertelement <3 x half> poison, half [[X]], i64 0 339; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <3 x half> [[INSERT]], <3 x half> poison, <3 x i32> zeroinitializer 340; CHECK-NEXT: [[MIN:%.*]] = tail call <3 x half> @llvm.maxnum.v3f16(<3 x half> [[SHUFFLE]], <3 x half> [[Y]]) 341; CHECK-NEXT: ret <3 x half> [[MIN]] 342; 343 %insert = insertelement <3 x half> poison, half %x, i64 0 344 %shuffle = shufflevector <3 x half> %insert, <3 x half> poison, <3 x i32> zeroinitializer 345 %min = tail call <3 x half> @_Z4fmaxDv3_DhS_(<3 x half> %shuffle, <3 x half> %y) 346 ret <3 x half> %min 347} 348 349define <4 x half> @test_fmax_v4f16_f16(<4 x half> %x, half %y) { 350; CHECK-LABEL: define <4 x half> @test_fmax_v4f16_f16 351; CHECK-SAME: (<4 x half> [[X:%.*]], half [[Y:%.*]]) { 352; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x half> poison, half [[Y]], i64 0 353; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x half> [[DOTSPLATINSERT]], <4 x half> poison, <4 x i32> zeroinitializer 354; CHECK-NEXT: [[MIN:%.*]] = tail call <4 x half> @llvm.maxnum.v4f16(<4 x half> [[X]], <4 x half> [[DOTSPLAT]]) 355; CHECK-NEXT: ret <4 x half> [[MIN]] 356; 357 %min = tail call <4 x half> @_Z4fmaxDv4_DhDh(<4 x half> %x, half %y) 358 ret <4 x half> %min 359} 360 361define <4 x half> @test_fmax_f16_v4f16(half %x, <4 x half> %y) { 362; CHECK-LABEL: define <4 x half> @test_fmax_f16_v4f16 363; CHECK-SAME: (half [[X:%.*]], <4 x half> [[Y:%.*]]) { 364; CHECK-NEXT: [[INSERT:%.*]] = insertelement <4 x half> poison, half [[X]], i64 0 365; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <4 x half> [[INSERT]], <4 x half> poison, <4 x i32> zeroinitializer 366; CHECK-NEXT: [[MIN:%.*]] = tail call <4 x half> @llvm.maxnum.v4f16(<4 x half> [[SHUFFLE]], <4 x half> [[Y]]) 367; CHECK-NEXT: ret <4 x half> [[MIN]] 368; 369 %insert = insertelement <4 x half> poison, half %x, i64 0 370 %shuffle = shufflevector <4 x half> %insert, <4 x half> poison, <4 x i32> zeroinitializer 371 %min = tail call <4 x half> @_Z4fmaxDv4_DhS_(<4 x half> %shuffle, <4 x half> %y) 372 ret <4 x half> %min 373} 374 375define <8 x half> @test_fmax_v8f16_f16(<8 x half> %x, half %y) { 376; CHECK-LABEL: define <8 x half> @test_fmax_v8f16_f16 377; CHECK-SAME: (<8 x half> [[X:%.*]], half [[Y:%.*]]) { 378; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <8 x half> poison, half [[Y]], i64 0 379; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x half> [[DOTSPLATINSERT]], <8 x half> poison, <8 x i32> zeroinitializer 380; CHECK-NEXT: [[MIN:%.*]] = tail call <8 x half> @llvm.maxnum.v8f16(<8 x half> [[X]], <8 x half> [[DOTSPLAT]]) 381; CHECK-NEXT: ret <8 x half> [[MIN]] 382; 383 %min = tail call <8 x half> @_Z4fmaxDv8_DhDh(<8 x half> %x, half %y) 384 ret <8 x half> %min 385} 386 387define <8 x half> @test_fmax_f16_v8f16(half %x, <8 x half> %y) { 388; CHECK-LABEL: define <8 x half> @test_fmax_f16_v8f16 389; CHECK-SAME: (half [[X:%.*]], <8 x half> [[Y:%.*]]) { 390; CHECK-NEXT: [[INSERT:%.*]] = insertelement <8 x half> poison, half [[X]], i64 0 391; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <8 x half> [[INSERT]], <8 x half> poison, <8 x i32> zeroinitializer 392; CHECK-NEXT: [[MIN:%.*]] = tail call <8 x half> @llvm.maxnum.v8f16(<8 x half> [[SHUFFLE]], <8 x half> [[Y]]) 393; CHECK-NEXT: ret <8 x half> [[MIN]] 394; 395 %insert = insertelement <8 x half> poison, half %x, i64 0 396 %shuffle = shufflevector <8 x half> %insert, <8 x half> poison, <8 x i32> zeroinitializer 397 %min = tail call <8 x half> @_Z4fmaxDv8_DhS_(<8 x half> %shuffle, <8 x half> %y) 398 ret <8 x half> %min 399} 400 401define <16 x half> @test_fmax_v16f16_f16(<16 x half> %x, half %y) { 402; CHECK-LABEL: define <16 x half> @test_fmax_v16f16_f16 403; CHECK-SAME: (<16 x half> [[X:%.*]], half [[Y:%.*]]) { 404; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <16 x half> poison, half [[Y]], i64 0 405; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <16 x half> [[DOTSPLATINSERT]], <16 x half> poison, <16 x i32> zeroinitializer 406; CHECK-NEXT: [[MIN:%.*]] = tail call <16 x half> @llvm.maxnum.v16f16(<16 x half> [[X]], <16 x half> [[DOTSPLAT]]) 407; CHECK-NEXT: ret <16 x half> [[MIN]] 408; 409 %min = tail call <16 x half> @_Z4fmaxDv16_DhDh(<16 x half> %x, half %y) 410 ret <16 x half> %min 411} 412 413define <16 x half> @test_fmax_f16_v16f16(half %x, <16 x half> %y) { 414; CHECK-LABEL: define <16 x half> @test_fmax_f16_v16f16 415; CHECK-SAME: (half [[X:%.*]], <16 x half> [[Y:%.*]]) { 416; CHECK-NEXT: [[INSERT:%.*]] = insertelement <16 x half> poison, half [[X]], i64 0 417; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <16 x half> [[INSERT]], <16 x half> poison, <16 x i32> zeroinitializer 418; CHECK-NEXT: [[MIN:%.*]] = tail call <16 x half> @llvm.maxnum.v16f16(<16 x half> [[SHUFFLE]], <16 x half> [[Y]]) 419; CHECK-NEXT: ret <16 x half> [[MIN]] 420; 421 %insert = insertelement <16 x half> poison, half %x, i64 0 422 %shuffle = shufflevector <16 x half> %insert, <16 x half> poison, <16 x i32> zeroinitializer 423 %min = tail call <16 x half> @_Z4fmaxDv16_DhS_(<16 x half> %shuffle, <16 x half> %y) 424 ret <16 x half> %min 425} 426