blob: 7bf82f39b938c2da14599bd073143f18442ab3a1 [file]
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt -S -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal < %s | FileCheck --check-prefixes=CHECK,TUNIT %s
define float @bitcast_umax_not_nan(float nofpclass(nan) %x, float nofpclass(nan) %y) {
; CHECK-LABEL: define nofpclass(nan) float @bitcast_umax_not_nan(
; CHECK-SAME: float nofpclass(nan) [[X:%.*]], float nofpclass(nan) [[Y:%.*]]) #[[ATTR0:[0-9]+]] {
; CHECK-NEXT: [[CAST_X:%.*]] = bitcast float [[X]] to i32
; CHECK-NEXT: [[CAST_Y:%.*]] = bitcast float [[Y]] to i32
; CHECK-NEXT: [[UMAX:%.*]] = call i32 @llvm.umax.i32(i32 [[CAST_X]], i32 [[CAST_Y]]) #[[ATTR2:[0-9]+]]
; CHECK-NEXT: [[CAST:%.*]] = bitcast i32 [[UMAX]] to float
; CHECK-NEXT: ret float [[CAST]]
;
%cast.x = bitcast float %x to i32
%cast.y = bitcast float %y to i32
%umax = call i32 @llvm.umax.i32(i32 %cast.x, i32 %cast.y)
%cast = bitcast i32 %umax to float
ret float %cast
}
define float @bitcast_umin_not_nan(float nofpclass(nan) %x, float nofpclass(nan) %y) {
; CHECK-LABEL: define nofpclass(nan) float @bitcast_umin_not_nan(
; CHECK-SAME: float nofpclass(nan) [[X:%.*]], float nofpclass(nan) [[Y:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: [[CAST_X:%.*]] = bitcast float [[X]] to i32
; CHECK-NEXT: [[CAST_Y:%.*]] = bitcast float [[Y]] to i32
; CHECK-NEXT: [[UMIN:%.*]] = call i32 @llvm.umin.i32(i32 [[CAST_X]], i32 [[CAST_Y]]) #[[ATTR2]]
; CHECK-NEXT: [[CAST:%.*]] = bitcast i32 [[UMIN]] to float
; CHECK-NEXT: ret float [[CAST]]
;
%cast.x = bitcast float %x to i32
%cast.y = bitcast float %y to i32
%umin = call i32 @llvm.umin.i32(i32 %cast.x, i32 %cast.y)
%cast = bitcast i32 %umin to float
ret float %cast
}
define float @bitcast_smax_not_nan(float nofpclass(nan) %x, float nofpclass(nan) %y) {
; CHECK-LABEL: define nofpclass(nan) float @bitcast_smax_not_nan(
; CHECK-SAME: float nofpclass(nan) [[X:%.*]], float nofpclass(nan) [[Y:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: [[CAST_X:%.*]] = bitcast float [[X]] to i32
; CHECK-NEXT: [[CAST_Y:%.*]] = bitcast float [[Y]] to i32
; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[CAST_X]], i32 [[CAST_Y]]) #[[ATTR2]]
; CHECK-NEXT: [[CAST:%.*]] = bitcast i32 [[SMAX]] to float
; CHECK-NEXT: ret float [[CAST]]
;
%cast.x = bitcast float %x to i32
%cast.y = bitcast float %y to i32
%smax = call i32 @llvm.smax.i32(i32 %cast.x, i32 %cast.y)
%cast = bitcast i32 %smax to float
ret float %cast
}
define float @bitcast_smin_not_nan(float nofpclass(nan) %x, float nofpclass(nan) %y) {
; CHECK-LABEL: define nofpclass(nan) float @bitcast_smin_not_nan(
; CHECK-SAME: float nofpclass(nan) [[X:%.*]], float nofpclass(nan) [[Y:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: [[CAST_X:%.*]] = bitcast float [[X]] to i32
; CHECK-NEXT: [[CAST_Y:%.*]] = bitcast float [[Y]] to i32
; CHECK-NEXT: [[SMIN:%.*]] = call i32 @llvm.smin.i32(i32 [[CAST_X]], i32 [[CAST_Y]]) #[[ATTR2]]
; CHECK-NEXT: [[CAST:%.*]] = bitcast i32 [[SMIN]] to float
; CHECK-NEXT: ret float [[CAST]]
;
%cast.x = bitcast float %x to i32
%cast.y = bitcast float %y to i32
%smin = call i32 @llvm.smin.i32(i32 %cast.x, i32 %cast.y)
%cast = bitcast i32 %smin to float
ret float %cast
}
define <2 x float> @bitcast_umax_not_nan_vec(<2 x float> nofpclass(nan) %x, <2 x float> nofpclass(nan) %y) {
; CHECK-LABEL: define nofpclass(nan) <2 x float> @bitcast_umax_not_nan_vec(
; CHECK-SAME: <2 x float> nofpclass(nan) [[X:%.*]], <2 x float> nofpclass(nan) [[Y:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: [[CAST_X:%.*]] = bitcast <2 x float> [[X]] to <2 x i32>
; CHECK-NEXT: [[CAST_Y:%.*]] = bitcast <2 x float> [[Y]] to <2 x i32>
; CHECK-NEXT: [[UMAX:%.*]] = call <2 x i32> @llvm.umax.v2i32(<2 x i32> [[CAST_X]], <2 x i32> [[CAST_Y]]) #[[ATTR2]]
; CHECK-NEXT: [[CAST:%.*]] = bitcast <2 x i32> [[UMAX]] to <2 x float>
; CHECK-NEXT: ret <2 x float> [[CAST]]
;
%cast.x = bitcast <2 x float> %x to <2 x i32>
%cast.y = bitcast <2 x float> %y to <2 x i32>
%umax = call <2 x i32> @llvm.umax.v2i32(<2 x i32> %cast.x, <2 x i32> %cast.y)
%cast = bitcast <2 x i32> %umax to <2 x float>
ret <2 x float> %cast
}
define float @bitcast_umax_mismatch_different(float nofpclass(inf) %x, float nofpclass(nan) %y) {
; CHECK-LABEL: define float @bitcast_umax_mismatch_different(
; CHECK-SAME: float nofpclass(inf) [[X:%.*]], float nofpclass(nan) [[Y:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: [[CAST_X:%.*]] = bitcast float [[X]] to i32
; CHECK-NEXT: [[CAST_Y:%.*]] = bitcast float [[Y]] to i32
; CHECK-NEXT: [[UMAX:%.*]] = call i32 @llvm.umax.i32(i32 [[CAST_X]], i32 [[CAST_Y]]) #[[ATTR2]]
; CHECK-NEXT: [[CAST:%.*]] = bitcast i32 [[UMAX]] to float
; CHECK-NEXT: ret float [[CAST]]
;
%cast.x = bitcast float %x to i32
%cast.y = bitcast float %y to i32
%umax = call i32 @llvm.umax.i32(i32 %cast.x, i32 %cast.y)
%cast = bitcast i32 %umax to float
ret float %cast
}
define float @bitcast_umax_missing_lhs(float %x, float nofpclass(nan) %y) {
; CHECK-LABEL: define float @bitcast_umax_missing_lhs(
; CHECK-SAME: float [[X:%.*]], float nofpclass(nan) [[Y:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: [[CAST_X:%.*]] = bitcast float [[X]] to i32
; CHECK-NEXT: [[CAST_Y:%.*]] = bitcast float [[Y]] to i32
; CHECK-NEXT: [[UMAX:%.*]] = call i32 @llvm.umax.i32(i32 [[CAST_X]], i32 [[CAST_Y]]) #[[ATTR2]]
; CHECK-NEXT: [[CAST:%.*]] = bitcast i32 [[UMAX]] to float
; CHECK-NEXT: ret float [[CAST]]
;
%cast.x = bitcast float %x to i32
%cast.y = bitcast float %y to i32
%umax = call i32 @llvm.umax.i32(i32 %cast.x, i32 %cast.y)
%cast = bitcast i32 %umax to float
ret float %cast
}
define float @bitcast_umax_missing_rhs(float nofpclass(nan) %x, float %y) {
; CHECK-LABEL: define float @bitcast_umax_missing_rhs(
; CHECK-SAME: float nofpclass(nan) [[X:%.*]], float [[Y:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: [[CAST_X:%.*]] = bitcast float [[X]] to i32
; CHECK-NEXT: [[CAST_Y:%.*]] = bitcast float [[Y]] to i32
; CHECK-NEXT: [[UMAX:%.*]] = call i32 @llvm.umax.i32(i32 [[CAST_X]], i32 [[CAST_Y]]) #[[ATTR2]]
; CHECK-NEXT: [[CAST:%.*]] = bitcast i32 [[UMAX]] to float
; CHECK-NEXT: ret float [[CAST]]
;
%cast.x = bitcast float %x to i32
%cast.y = bitcast float %y to i32
%umax = call i32 @llvm.umax.i32(i32 %cast.x, i32 %cast.y)
%cast = bitcast i32 %umax to float
ret float %cast
}
define float @bitcast_umax_not_nan__not_elementwise_cast(<2 x half> nofpclass(nan) %x, <2 x half> nofpclass(nan) %y) {
; CHECK-LABEL: define float @bitcast_umax_not_nan__not_elementwise_cast(
; CHECK-SAME: <2 x half> nofpclass(nan) [[X:%.*]], <2 x half> nofpclass(nan) [[Y:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: [[CAST_X:%.*]] = bitcast <2 x half> [[X]] to i32
; CHECK-NEXT: [[CAST_Y:%.*]] = bitcast <2 x half> [[Y]] to i32
; CHECK-NEXT: [[UMAX:%.*]] = call i32 @llvm.umax.i32(i32 [[CAST_X]], i32 [[CAST_Y]]) #[[ATTR2]]
; CHECK-NEXT: [[CAST:%.*]] = bitcast i32 [[UMAX]] to float
; CHECK-NEXT: ret float [[CAST]]
;
%cast.x = bitcast <2 x half> %x to i32
%cast.y = bitcast <2 x half> %y to i32
%umax = call i32 @llvm.umax.i32(i32 %cast.x, i32 %cast.y)
%cast = bitcast i32 %umax to float
ret float %cast
}
define bfloat @bitcast_wrong_type_umax_not_nan(half nofpclass(nan) %x, half nofpclass(nan) %y) {
; CHECK-LABEL: define bfloat @bitcast_wrong_type_umax_not_nan(
; CHECK-SAME: half nofpclass(nan) [[X:%.*]], half nofpclass(nan) [[Y:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: [[CAST_X:%.*]] = bitcast half [[X]] to i16
; CHECK-NEXT: [[CAST_Y:%.*]] = bitcast half [[Y]] to i16
; CHECK-NEXT: [[UMAX:%.*]] = call i16 @llvm.umax.i16(i16 [[CAST_X]], i16 [[CAST_Y]]) #[[ATTR2]]
; CHECK-NEXT: [[CAST:%.*]] = bitcast i16 [[UMAX]] to bfloat
; CHECK-NEXT: ret bfloat [[CAST]]
;
%cast.x = bitcast half %x to i16
%cast.y = bitcast half %y to i16
%umax = call i16 @llvm.umax.i16(i16 %cast.x, i16 %cast.y)
%cast = bitcast i16 %umax to bfloat
ret bfloat %cast
}
define <2 x bfloat> @bitcast_wrong_type_umax_vec_not_nan(<2 x half> nofpclass(nan) %x, <2 x half> nofpclass(nan) %y) {
; CHECK-LABEL: define <2 x bfloat> @bitcast_wrong_type_umax_vec_not_nan(
; CHECK-SAME: <2 x half> nofpclass(nan) [[X:%.*]], <2 x half> nofpclass(nan) [[Y:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: [[CAST_X:%.*]] = bitcast <2 x half> [[X]] to <2 x i16>
; CHECK-NEXT: [[CAST_Y:%.*]] = bitcast <2 x half> [[Y]] to <2 x i16>
; CHECK-NEXT: [[UMAX:%.*]] = call <2 x i16> @llvm.umax.v2i16(<2 x i16> [[CAST_X]], <2 x i16> [[CAST_Y]]) #[[ATTR2]]
; CHECK-NEXT: [[CAST:%.*]] = bitcast <2 x i16> [[UMAX]] to <2 x bfloat>
; CHECK-NEXT: ret <2 x bfloat> [[CAST]]
;
%cast.x = bitcast <2 x half> %x to <2 x i16>
%cast.y = bitcast <2 x half> %y to <2 x i16>
%umax = call <2 x i16> @llvm.umax.v2i16(<2 x i16> %cast.x, <2 x i16> %cast.y)
%cast = bitcast <2 x i16> %umax to <2 x bfloat>
ret <2 x bfloat> %cast
}
define half @bitcast_wrong_type_lhs_umax_not_nan(bfloat nofpclass(nan) %x, half nofpclass(nan) %y) {
; CHECK-LABEL: define half @bitcast_wrong_type_lhs_umax_not_nan(
; CHECK-SAME: bfloat nofpclass(nan) [[X:%.*]], half nofpclass(nan) [[Y:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: [[CAST_X:%.*]] = bitcast bfloat [[X]] to i16
; CHECK-NEXT: [[CAST_Y:%.*]] = bitcast half [[Y]] to i16
; CHECK-NEXT: [[UMAX:%.*]] = call i16 @llvm.umax.i16(i16 [[CAST_X]], i16 [[CAST_Y]]) #[[ATTR2]]
; CHECK-NEXT: [[CAST:%.*]] = bitcast i16 [[UMAX]] to half
; CHECK-NEXT: ret half [[CAST]]
;
%cast.x = bitcast bfloat %x to i16
%cast.y = bitcast half %y to i16
%umax = call i16 @llvm.umax.i16(i16 %cast.x, i16 %cast.y)
%cast = bitcast i16 %umax to half
ret half %cast
}
define half @bitcast_wrong_type_rhs_umax_not_nan(half nofpclass(nan) %x, bfloat nofpclass(nan) %y) {
; CHECK-LABEL: define half @bitcast_wrong_type_rhs_umax_not_nan(
; CHECK-SAME: half nofpclass(nan) [[X:%.*]], bfloat nofpclass(nan) [[Y:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: [[CAST_X:%.*]] = bitcast half [[X]] to i16
; CHECK-NEXT: [[CAST_Y:%.*]] = bitcast bfloat [[Y]] to i16
; CHECK-NEXT: [[UMAX:%.*]] = call i16 @llvm.umax.i16(i16 [[CAST_X]], i16 [[CAST_Y]]) #[[ATTR2]]
; CHECK-NEXT: [[CAST:%.*]] = bitcast i16 [[UMAX]] to half
; CHECK-NEXT: ret half [[CAST]]
;
%cast.x = bitcast half %x to i16
%cast.y = bitcast bfloat %y to i16
%umax = call i16 @llvm.umax.i16(i16 %cast.x, i16 %cast.y)
%cast = bitcast i16 %umax to half
ret half %cast
}
define float @bitcast_umax_v32i1_not_nan(float nofpclass(nan) %x, float nofpclass(nan) %y) {
; CHECK-LABEL: define float @bitcast_umax_v32i1_not_nan(
; CHECK-SAME: float nofpclass(nan) [[X:%.*]], float nofpclass(nan) [[Y:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: [[CAST_X:%.*]] = bitcast float [[X]] to <32 x i1>
; CHECK-NEXT: [[CAST_Y:%.*]] = bitcast float [[Y]] to <32 x i1>
; CHECK-NEXT: [[UMAX:%.*]] = call <32 x i1> @llvm.umax.v32i1(<32 x i1> [[CAST_X]], <32 x i1> [[CAST_Y]]) #[[ATTR2]]
; CHECK-NEXT: [[CAST:%.*]] = bitcast <32 x i1> [[UMAX]] to float
; CHECK-NEXT: ret float [[CAST]]
;
%cast.x = bitcast float %x to <32 x i1>
%cast.y = bitcast float %y to <32 x i1>
%umax = call <32 x i1> @llvm.umax.v32i1(<32 x i1> %cast.x, <32 x i1> %cast.y)
%cast = bitcast <32 x i1> %umax to float
ret float %cast
}
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; TUNIT: {{.*}}