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 float @_Z4fmaxff(float, float) 7declare <2 x float> @_Z4fmaxDv2_fS_(<2 x float>, <2 x float>) 8declare <3 x float> @_Z4fmaxDv3_fS_(<3 x float>, <3 x float>) 9declare <4 x float> @_Z4fmaxDv4_fS_(<4 x float>, <4 x float>) 10declare <8 x float> @_Z4fmaxDv8_fS_(<8 x float>, <8 x float>) 11declare <16 x float> @_Z4fmaxDv16_fS_(<16 x float>, <16 x float>) 12declare double @_Z4fmaxdd(double, double) 13declare <2 x double> @_Z4fmaxDv2_dS_(<2 x double>, <2 x double>) 14declare <3 x double> @_Z4fmaxDv3_dS_(<3 x double>, <3 x double>) 15declare <4 x double> @_Z4fmaxDv4_dS_(<4 x double>, <4 x double>) 16declare <8 x double> @_Z4fmaxDv8_dS_(<8 x double>, <8 x double>) 17declare <16 x double> @_Z4fmaxDv16_dS_(<16 x double>, <16 x double>) 18declare half @_Z4fmaxDhDh(half, half) 19declare <2 x half> @_Z4fmaxDv2_DhS_(<2 x half>, <2 x half>) 20declare <3 x half> @_Z4fmaxDv3_DhS_(<3 x half>, <3 x half>) 21declare <4 x half> @_Z4fmaxDv4_DhS_(<4 x half>, <4 x half>) 22declare <8 x half> @_Z4fmaxDv8_DhS_(<8 x half>, <8 x half>) 23declare <16 x half> @_Z4fmaxDv16_DhS_(<16 x half>, <16 x half>) 24 25define float @test_fmax_f32(float %x, float %y) { 26; CHECK-LABEL: define float @test_fmax_f32 27; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) { 28; CHECK-NEXT: [[FMAX:%.*]] = tail call float @llvm.maxnum.f32(float [[X]], float [[Y]]) 29; CHECK-NEXT: ret float [[FMAX]] 30; 31 %fmax = tail call float @_Z4fmaxff(float %x, float %y) 32 ret float %fmax 33} 34 35define float @test_fmax_f32_nnan(float %x, float %y) { 36; CHECK-LABEL: define float @test_fmax_f32_nnan 37; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) { 38; CHECK-NEXT: [[FMAX:%.*]] = tail call nnan float @llvm.maxnum.f32(float [[X]], float [[Y]]) 39; CHECK-NEXT: ret float [[FMAX]] 40; 41 %fmax = tail call nnan float @_Z4fmaxff(float %x, float %y) 42 ret float %fmax 43} 44 45define <2 x float> @test_fmax_v2f32(<2 x float> %x, <2 x float> %y) { 46; CHECK-LABEL: define <2 x float> @test_fmax_v2f32 47; CHECK-SAME: (<2 x float> [[X:%.*]], <2 x float> [[Y:%.*]]) { 48; CHECK-NEXT: [[FMAX:%.*]] = tail call <2 x float> @llvm.maxnum.v2f32(<2 x float> [[X]], <2 x float> [[Y]]) 49; CHECK-NEXT: ret <2 x float> [[FMAX]] 50; 51 %fmax = tail call <2 x float> @_Z4fmaxDv2_fS_(<2 x float> %x, <2 x float> %y) 52 ret <2 x float> %fmax 53} 54 55define <3 x float> @test_fmax_v3f32(<3 x float> %x, <3 x float> %y) { 56; CHECK-LABEL: define <3 x float> @test_fmax_v3f32 57; CHECK-SAME: (<3 x float> [[X:%.*]], <3 x float> [[Y:%.*]]) { 58; CHECK-NEXT: [[FMAX:%.*]] = tail call <3 x float> @llvm.maxnum.v3f32(<3 x float> [[X]], <3 x float> [[Y]]) 59; CHECK-NEXT: ret <3 x float> [[FMAX]] 60; 61 %fmax = tail call <3 x float> @_Z4fmaxDv3_fS_(<3 x float> %x, <3 x float> %y) 62 ret <3 x float> %fmax 63} 64 65define <4 x float> @test_fmax_v4f32(<4 x float> %x, <4 x float> %y) { 66; CHECK-LABEL: define <4 x float> @test_fmax_v4f32 67; CHECK-SAME: (<4 x float> [[X:%.*]], <4 x float> [[Y:%.*]]) { 68; CHECK-NEXT: [[FMAX:%.*]] = tail call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[X]], <4 x float> [[Y]]) 69; CHECK-NEXT: ret <4 x float> [[FMAX]] 70; 71 %fmax = tail call <4 x float> @_Z4fmaxDv4_fS_(<4 x float> %x, <4 x float> %y) 72 ret <4 x float> %fmax 73} 74 75define <8 x float> @test_fmax_v8f32(<8 x float> %x, <8 x float> %y) { 76; CHECK-LABEL: define <8 x float> @test_fmax_v8f32 77; CHECK-SAME: (<8 x float> [[X:%.*]], <8 x float> [[Y:%.*]]) { 78; CHECK-NEXT: [[FMAX:%.*]] = tail call <8 x float> @llvm.maxnum.v8f32(<8 x float> [[X]], <8 x float> [[Y]]) 79; CHECK-NEXT: ret <8 x float> [[FMAX]] 80; 81 %fmax = tail call <8 x float> @_Z4fmaxDv8_fS_(<8 x float> %x, <8 x float> %y) 82 ret <8 x float> %fmax 83} 84 85define <16 x float> @test_fmax_v16f32(<16 x float> %x, <16 x float> %y) { 86; CHECK-LABEL: define <16 x float> @test_fmax_v16f32 87; CHECK-SAME: (<16 x float> [[X:%.*]], <16 x float> [[Y:%.*]]) { 88; CHECK-NEXT: [[FMAX:%.*]] = tail call <16 x float> @llvm.maxnum.v16f32(<16 x float> [[X]], <16 x float> [[Y]]) 89; CHECK-NEXT: ret <16 x float> [[FMAX]] 90; 91 %fmax = tail call <16 x float> @_Z4fmaxDv16_fS_(<16 x float> %x, <16 x float> %y) 92 ret <16 x float> %fmax 93} 94 95define double @test_fmax_f64(double %x, double %y) { 96; CHECK-LABEL: define double @test_fmax_f64 97; CHECK-SAME: (double [[X:%.*]], double [[Y:%.*]]) { 98; CHECK-NEXT: [[FMAX:%.*]] = tail call double @llvm.maxnum.f64(double [[X]], double [[Y]]) 99; CHECK-NEXT: ret double [[FMAX]] 100; 101 %fmax = tail call double @_Z4fmaxdd(double %x, double %y) 102 ret double %fmax 103} 104 105define <2 x double> @test_fmax_v2f64(<2 x double> %x, <2 x double> %y) { 106; CHECK-LABEL: define <2 x double> @test_fmax_v2f64 107; CHECK-SAME: (<2 x double> [[X:%.*]], <2 x double> [[Y:%.*]]) { 108; CHECK-NEXT: [[FMAX:%.*]] = tail call <2 x double> @llvm.maxnum.v2f64(<2 x double> [[X]], <2 x double> [[Y]]) 109; CHECK-NEXT: ret <2 x double> [[FMAX]] 110; 111 %fmax = tail call <2 x double> @_Z4fmaxDv2_dS_(<2 x double> %x, <2 x double> %y) 112 ret <2 x double> %fmax 113} 114 115define <3 x double> @test_fmax_v3f64(<3 x double> %x, <3 x double> %y) { 116; CHECK-LABEL: define <3 x double> @test_fmax_v3f64 117; CHECK-SAME: (<3 x double> [[X:%.*]], <3 x double> [[Y:%.*]]) { 118; CHECK-NEXT: [[FMAX:%.*]] = tail call <3 x double> @llvm.maxnum.v3f64(<3 x double> [[X]], <3 x double> [[Y]]) 119; CHECK-NEXT: ret <3 x double> [[FMAX]] 120; 121 %fmax = tail call <3 x double> @_Z4fmaxDv3_dS_(<3 x double> %x, <3 x double> %y) 122 ret <3 x double> %fmax 123} 124 125define <4 x double> @test_fmax_v4f64(<4 x double> %x, <4 x double> %y) { 126; CHECK-LABEL: define <4 x double> @test_fmax_v4f64 127; CHECK-SAME: (<4 x double> [[X:%.*]], <4 x double> [[Y:%.*]]) { 128; CHECK-NEXT: [[FMAX:%.*]] = tail call <4 x double> @llvm.maxnum.v4f64(<4 x double> [[X]], <4 x double> [[Y]]) 129; CHECK-NEXT: ret <4 x double> [[FMAX]] 130; 131 %fmax = tail call <4 x double> @_Z4fmaxDv4_dS_(<4 x double> %x, <4 x double> %y) 132 ret <4 x double> %fmax 133} 134 135define <8 x double> @test_fmax_v8f64(<8 x double> %x, <8 x double> %y) { 136; CHECK-LABEL: define <8 x double> @test_fmax_v8f64 137; CHECK-SAME: (<8 x double> [[X:%.*]], <8 x double> [[Y:%.*]]) { 138; CHECK-NEXT: [[FMAX:%.*]] = tail call <8 x double> @llvm.maxnum.v8f64(<8 x double> [[X]], <8 x double> [[Y]]) 139; CHECK-NEXT: ret <8 x double> [[FMAX]] 140; 141 %fmax = tail call <8 x double> @_Z4fmaxDv8_dS_(<8 x double> %x, <8 x double> %y) 142 ret <8 x double> %fmax 143} 144 145define <16 x double> @test_fmax_v16f64(<16 x double> %x, <16 x double> %y) { 146; CHECK-LABEL: define <16 x double> @test_fmax_v16f64 147; CHECK-SAME: (<16 x double> [[X:%.*]], <16 x double> [[Y:%.*]]) { 148; CHECK-NEXT: [[FMAX:%.*]] = tail call <16 x double> @llvm.maxnum.v16f64(<16 x double> [[X]], <16 x double> [[Y]]) 149; CHECK-NEXT: ret <16 x double> [[FMAX]] 150; 151 %fmax = tail call <16 x double> @_Z4fmaxDv16_dS_(<16 x double> %x, <16 x double> %y) 152 ret <16 x double> %fmax 153} 154 155define half @test_fmax_f16(half %x, half %y) { 156; CHECK-LABEL: define half @test_fmax_f16 157; CHECK-SAME: (half [[X:%.*]], half [[Y:%.*]]) { 158; CHECK-NEXT: [[FMAX:%.*]] = tail call half @llvm.maxnum.f16(half [[X]], half [[Y]]) 159; CHECK-NEXT: ret half [[FMAX]] 160; 161 %fmax = tail call half @_Z4fmaxDhDh(half %x, half %y) 162 ret half %fmax 163} 164 165define <2 x half> @test_fmax_v2f16(<2 x half> %x, <2 x half> %y) { 166; CHECK-LABEL: define <2 x half> @test_fmax_v2f16 167; CHECK-SAME: (<2 x half> [[X:%.*]], <2 x half> [[Y:%.*]]) { 168; CHECK-NEXT: [[FMAX:%.*]] = tail call <2 x half> @llvm.maxnum.v2f16(<2 x half> [[X]], <2 x half> [[Y]]) 169; CHECK-NEXT: ret <2 x half> [[FMAX]] 170; 171 %fmax = tail call <2 x half> @_Z4fmaxDv2_DhS_(<2 x half> %x, <2 x half> %y) 172 ret <2 x half> %fmax 173} 174 175define <3 x half> @test_fmax_v3f16(<3 x half> %x, <3 x half> %y) { 176; CHECK-LABEL: define <3 x half> @test_fmax_v3f16 177; CHECK-SAME: (<3 x half> [[X:%.*]], <3 x half> [[Y:%.*]]) { 178; CHECK-NEXT: [[FMAX:%.*]] = tail call <3 x half> @llvm.maxnum.v3f16(<3 x half> [[X]], <3 x half> [[Y]]) 179; CHECK-NEXT: ret <3 x half> [[FMAX]] 180; 181 %fmax = tail call <3 x half> @_Z4fmaxDv3_DhS_(<3 x half> %x, <3 x half> %y) 182 ret <3 x half> %fmax 183} 184 185define <4 x half> @test_fmax_v4f16(<4 x half> %x, <4 x half> %y) { 186; CHECK-LABEL: define <4 x half> @test_fmax_v4f16 187; CHECK-SAME: (<4 x half> [[X:%.*]], <4 x half> [[Y:%.*]]) { 188; CHECK-NEXT: [[FMAX:%.*]] = tail call <4 x half> @llvm.maxnum.v4f16(<4 x half> [[X]], <4 x half> [[Y]]) 189; CHECK-NEXT: ret <4 x half> [[FMAX]] 190; 191 %fmax = tail call <4 x half> @_Z4fmaxDv4_DhS_(<4 x half> %x, <4 x half> %y) 192 ret <4 x half> %fmax 193} 194 195define <8 x half> @test_fmax_v8f16(<8 x half> %x, <8 x half> %y) { 196; CHECK-LABEL: define <8 x half> @test_fmax_v8f16 197; CHECK-SAME: (<8 x half> [[X:%.*]], <8 x half> [[Y:%.*]]) { 198; CHECK-NEXT: [[FMAX:%.*]] = tail call <8 x half> @llvm.maxnum.v8f16(<8 x half> [[X]], <8 x half> [[Y]]) 199; CHECK-NEXT: ret <8 x half> [[FMAX]] 200; 201 %fmax = tail call <8 x half> @_Z4fmaxDv8_DhS_(<8 x half> %x, <8 x half> %y) 202 ret <8 x half> %fmax 203} 204 205define <16 x half> @test_fmax_v16f16(<16 x half> %x, <16 x half> %y) { 206; CHECK-LABEL: define <16 x half> @test_fmax_v16f16 207; CHECK-SAME: (<16 x half> [[X:%.*]], <16 x half> [[Y:%.*]]) { 208; CHECK-NEXT: [[FMAX:%.*]] = tail call <16 x half> @llvm.maxnum.v16f16(<16 x half> [[X]], <16 x half> [[Y]]) 209; CHECK-NEXT: ret <16 x half> [[FMAX]] 210; 211 %fmax = tail call <16 x half> @_Z4fmaxDv16_DhS_(<16 x half> %x, <16 x half> %y) 212 ret <16 x half> %fmax 213} 214 215define float @test_fmax_f32_minsize(float %x, float %y) #0 { 216; CHECK-LABEL: define float @test_fmax_f32_minsize 217; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) #[[ATTR0:[0-9]+]] { 218; CHECK-NEXT: [[FMAX:%.*]] = tail call float @llvm.maxnum.f32(float [[X]], float [[Y]]) 219; CHECK-NEXT: ret float [[FMAX]] 220; 221 %fmax = tail call float @_Z4fmaxff(float %x, float %y) 222 ret float %fmax 223} 224 225define float @test_fmax_f32_nnan_minsize(float %x, float %y) #0 { 226; CHECK-LABEL: define float @test_fmax_f32_nnan_minsize 227; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) #[[ATTR0]] { 228; CHECK-NEXT: [[FMAX:%.*]] = tail call nnan float @llvm.maxnum.f32(float [[X]], float [[Y]]) 229; CHECK-NEXT: ret float [[FMAX]] 230; 231 %fmax = tail call nnan float @_Z4fmaxff(float %x, float %y) 232 ret float %fmax 233} 234 235define float @test_fmax_f32_noinline(float %x, float %y) { 236; CHECK-LABEL: define float @test_fmax_f32_noinline 237; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) { 238; CHECK-NEXT: [[FMAX:%.*]] = tail call float @_Z4fmaxff(float [[X]], float [[Y]]) #[[ATTR3:[0-9]+]] 239; CHECK-NEXT: ret float [[FMAX]] 240; 241 %fmax = tail call float @_Z4fmaxff(float %x, float %y) #1 242 ret float %fmax 243} 244 245define float @test_fmax_f32_nnan_noinline(float %x, float %y) { 246; CHECK-LABEL: define float @test_fmax_f32_nnan_noinline 247; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) { 248; CHECK-NEXT: [[FMAX:%.*]] = tail call nnan float @_Z4fmaxff(float [[X]], float [[Y]]) #[[ATTR3]] 249; CHECK-NEXT: ret float [[FMAX]] 250; 251 %fmax = tail call nnan float @_Z4fmaxff(float %x, float %y) #1 252 ret float %fmax 253} 254 255define float @test_fmax_f32_strictfp(float %x, float %y) #2 { 256; CHECK-LABEL: define float @test_fmax_f32_strictfp 257; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) #[[ATTR1:[0-9]+]] { 258; CHECK-NEXT: [[FMAX:%.*]] = tail call nnan nsz float @_Z4fmaxff(float [[X]], float [[Y]]) #[[ATTR1]] 259; CHECK-NEXT: ret float [[FMAX]] 260; 261 %fmax = tail call nsz nnan float @_Z4fmaxff(float %x, float %y) #2 262 ret float %fmax 263} 264 265define float @test_fmax_f32_fast_nobuiltin(float %x, float %y) { 266; CHECK-LABEL: define float @test_fmax_f32_fast_nobuiltin 267; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) { 268; CHECK-NEXT: [[FMAX:%.*]] = tail call fast float @_Z4fmaxff(float [[X]], float [[Y]]) #[[ATTR4:[0-9]+]] 269; CHECK-NEXT: ret float [[FMAX]] 270; 271 %fmax = tail call fast float @_Z4fmaxff(float %x, float %y) #3 272 ret float %fmax 273} 274 275attributes #0 = { minsize } 276attributes #1 = { noinline } 277attributes #2 = { strictfp } 278attributes #3 = { nobuiltin } 279