blob: e9a171c527a8821d21a32899530510df742b94b3 [file] [edit]
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt -passes=instcombine -S < %s | FileCheck %s
@flt_nan = constant float 0x7FF8000000000000, align 4
@flt_pos_min_subnormal = constant float 0x36A0000000000000, align 4
@flt_pos_min_normal = constant float 0x3810000000000000, align 4
@flt_pos_max = constant float 0x47EFFFFFE0000000, align 4
@flt_pos_infinity = constant float 0x7FF0000000000000, align 4
@flt_neg_min_subnormal = constant float 0xB6A0000000000000, align 4
@flt_neg_min_normal = constant float 0xB810000000000000, align 4
@flt_neg_max = constant float 0xC7EFFFFFE0000000, align 4
@flt_neg_infinity = constant float 0xFFF0000000000000, align 4
@dbl_nan = constant double 0x7FF8000000000000, align 8
@dbl_pos_min_subnormal = constant double 4.940660e-324, align 8
@dbl_pos_min_normal = constant double 0x10000000000000, align 8
@dbl_pos_max = constant double 0x7FEFFFFFFFFFFFFF, align 8
@dbl_pos_infinity = constant double 0x7FF0000000000000, align 8
@dbl_neg_min_subnormal = constant double -4.940660e-324, align 8
@dbl_neg_min_normal = constant double 0x8010000000000000, align 8
@dbl_neg_max = constant double 0xFFEFFFFFFFFFFFFF, align 8
@dbl_neg_infinity = constant double 0xFFF0000000000000, align 8
define double @nexttoward_up_direction() {
; CHECK-LABEL: define double @nexttoward_up_direction() {
; CHECK-NEXT: ret double f0x3FF0000000000001
;
%arg = fpext double 2.0 to ppc_fp128
%next = call double @nexttoward(double 1.0, ppc_fp128 %arg)
ret double %next
}
define float @nexttowardf_up_direction() {
; CHECK-LABEL: define float @nexttowardf_up_direction() {
; CHECK-NEXT: ret float f0x3F800001
;
%arg = fpext float 2.0 to ppc_fp128
%next = call float @nexttowardf(float 1.0, ppc_fp128 %arg)
ret float %next
}
define double @nexttoward_down_direction() {
; CHECK-LABEL: define double @nexttoward_down_direction() {
; CHECK-NEXT: ret double f0x3FEFFFFFFFFFFFFF
;
%arg = fpext double 0.0 to ppc_fp128
%next = call double @nexttoward(double 1.0, ppc_fp128 %arg)
ret double %next
}
define float @nexttowardf_down_direction() {
; CHECK-LABEL: define float @nexttowardf_down_direction() {
; CHECK-NEXT: ret float f0x3F7FFFFF
;
%arg = fpext float 0.0 to ppc_fp128
%next = call float @nexttowardf(float 1.0, ppc_fp128 %arg)
ret float %next
}
define double @nexttoward_pos_overflow() {
; CHECK-LABEL: define double @nexttoward_pos_overflow() {
; CHECK-NEXT: ret double +inf
;
%pos_max = load double, ptr @dbl_pos_max
%pos_inf = load double, ptr @dbl_pos_infinity
%ext_pos_inf = fpext double %pos_inf to ppc_fp128
%next = call double @nexttoward(double %pos_max, ppc_fp128 %ext_pos_inf)
ret double %next
}
define float @nexttowardf_pos_overflow () {
; CHECK-LABEL: define float @nexttowardf_pos_overflow() {
; CHECK-NEXT: ret float +inf
;
%pos_max = load float, ptr @flt_pos_max
%pos_inf = load float, ptr @flt_pos_infinity
%ext_pos_inf = fpext float %pos_inf to ppc_fp128
%next = call float @nexttowardf(float %pos_max, ppc_fp128 %ext_pos_inf)
ret float %next
}
define double @nexttoward_neg_overflow() {
; CHECK-LABEL: define double @nexttoward_neg_overflow() {
; CHECK-NEXT: ret double -inf
;
%neg_max = load double, ptr @dbl_neg_max
%neg_inf = load double, ptr @dbl_neg_infinity
%ext_neg_inf = fpext double %neg_inf to ppc_fp128
%next = call double @nexttoward(double %neg_max, ppc_fp128 %ext_neg_inf)
ret double %next
}
define float @nexttowardf_neg_overflow() {
; CHECK-LABEL: define float @nexttowardf_neg_overflow() {
; CHECK-NEXT: ret float -inf
;
%neg_max = load float, ptr @flt_neg_max
%neg_inf = load float, ptr @flt_neg_infinity
%ext_neg_inf = fpext float %neg_inf to ppc_fp128
%next = call float @nexttowardf(float %neg_max, ppc_fp128 %ext_neg_inf)
ret float %next
}
define double @nexttoward_subnormal() {
; CHECK-LABEL: define double @nexttoward_subnormal() {
; CHECK-NEXT: [[NEXT:%.*]] = call double @nexttoward(double 4.940660e-324, ppc_fp128 1.000000e+00)
; CHECK-NEXT: ret double [[NEXT]]
;
%subnormal = load double, ptr @dbl_pos_min_subnormal
%target = fpext double 1.0 to ppc_fp128
%next = call double @nexttoward(double %subnormal, ppc_fp128 %target)
ret double %next
}
define float @nexttowardf_subnormal() {
; CHECK-LABEL: define float @nexttowardf_subnormal() {
; CHECK-NEXT: [[NEXT:%.*]] = call float @nexttowardf(float 1.401300e-45, ppc_fp128 1.000000e+00)
; CHECK-NEXT: ret float [[NEXT]]
;
%subnormal = load float, ptr @flt_pos_min_subnormal
%target = fpext float 1.0 to ppc_fp128
%next = call float @nexttowardf(float %subnormal, ppc_fp128 %target)
ret float %next
}
declare double @nexttoward(double, ppc_fp128) #0
declare float @nexttowardf(float, ppc_fp128) #0
attributes #0 = { willreturn memory(errnomem: write) }