| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 |
| ; RUN: opt < %s -passes=instsimplify -march=nvptx64 --mcpu=sm_86 --mattr=+ptx72 -S | FileCheck %s |
| |
| ; Check constant-folding for NVVM add intrinsics with different rounding modes |
| |
| ;############################################################### |
| ;# Add(1.25, -2.0) # |
| ;############################################################### |
| ; Tests addition of two normal numbers (1.25 and -2.0) where the result |
| ; is exactly representable. All rounding modes produce the same result. |
| |
| define double @test_1_25_minus_2_rm_d() { |
| ; CHECK-LABEL: define double @test_1_25_minus_2_rm_d() { |
| ; CHECK-NEXT: ret double -7.500000e-01 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 1.25, double -2.0, /* rnd=rm */ i32 3) |
| ret double %res |
| } |
| |
| define double @test_1_25_minus_2_rn_d() { |
| ; CHECK-LABEL: define double @test_1_25_minus_2_rn_d() { |
| ; CHECK-NEXT: ret double -7.500000e-01 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 1.25, double -2.0, /* rnd=rn */ i32 1) |
| ret double %res |
| } |
| |
| define double @test_1_25_minus_2_rp_d() { |
| ; CHECK-LABEL: define double @test_1_25_minus_2_rp_d() { |
| ; CHECK-NEXT: ret double -7.500000e-01 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 1.25, double -2.0, /* rnd=rp */ i32 2) |
| ret double %res |
| } |
| |
| define double @test_1_25_minus_2_rz_d() { |
| ; CHECK-LABEL: define double @test_1_25_minus_2_rz_d() { |
| ; CHECK-NEXT: ret double -7.500000e-01 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 1.25, double -2.0, /* rnd=rz */ i32 0) |
| ret double %res |
| } |
| |
| define float @test_1_25_minus_2_rm_f() { |
| ; CHECK-LABEL: define float @test_1_25_minus_2_rm_f() { |
| ; CHECK-NEXT: ret float -7.500000e-01 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 1.25, float -2.0, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_1_25_minus_2_rn_f() { |
| ; CHECK-LABEL: define float @test_1_25_minus_2_rn_f() { |
| ; CHECK-NEXT: ret float -7.500000e-01 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 1.25, float -2.0, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_1_25_minus_2_rp_f() { |
| ; CHECK-LABEL: define float @test_1_25_minus_2_rp_f() { |
| ; CHECK-NEXT: ret float -7.500000e-01 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 1.25, float -2.0, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_1_25_minus_2_rz_f() { |
| ; CHECK-LABEL: define float @test_1_25_minus_2_rz_f() { |
| ; CHECK-NEXT: ret float -7.500000e-01 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 1.25, float -2.0, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| define float @test_1_25_minus_2_rm_ftz_f() { |
| ; CHECK-LABEL: define float @test_1_25_minus_2_rm_ftz_f() { |
| ; CHECK-NEXT: ret float -7.500000e-01 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 1.25, float -2.0, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_1_25_minus_2_rn_ftz_f() { |
| ; CHECK-LABEL: define float @test_1_25_minus_2_rn_ftz_f() { |
| ; CHECK-NEXT: ret float -7.500000e-01 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 1.25, float -2.0, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_1_25_minus_2_rp_ftz_f() { |
| ; CHECK-LABEL: define float @test_1_25_minus_2_rp_ftz_f() { |
| ; CHECK-NEXT: ret float -7.500000e-01 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 1.25, float -2.0, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_1_25_minus_2_rz_ftz_f() { |
| ; CHECK-LABEL: define float @test_1_25_minus_2_rz_ftz_f() { |
| ; CHECK-NEXT: ret float -7.500000e-01 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 1.25, float -2.0, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| define half @test_1_25_minus_2_rm_f16() { |
| ; CHECK-LABEL: define half @test_1_25_minus_2_rm_f16() { |
| ; CHECK-NEXT: ret half -7.500000e-01 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 1.25, half -2.0, /* rnd=rm */ i32 3) |
| ret half %res |
| } |
| |
| define half @test_1_25_minus_2_rn_f16() { |
| ; CHECK-LABEL: define half @test_1_25_minus_2_rn_f16() { |
| ; CHECK-NEXT: ret half -7.500000e-01 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 1.25, half -2.0, /* rnd=rn */ i32 1) |
| ret half %res |
| } |
| |
| define half @test_1_25_minus_2_rp_f16() { |
| ; CHECK-LABEL: define half @test_1_25_minus_2_rp_f16() { |
| ; CHECK-NEXT: ret half -7.500000e-01 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 1.25, half -2.0, /* rnd=rp */ i32 2) |
| ret half %res |
| } |
| |
| define half @test_1_25_minus_2_rz_f16() { |
| ; CHECK-LABEL: define half @test_1_25_minus_2_rz_f16() { |
| ; CHECK-NEXT: ret half -7.500000e-01 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 1.25, half -2.0, /* rnd=rz */ i32 0) |
| ret half %res |
| } |
| |
| define bfloat @test_1_25_minus_2_rm_bf16() { |
| ; CHECK-LABEL: define bfloat @test_1_25_minus_2_rm_bf16() { |
| ; CHECK-NEXT: ret bfloat -7.500000e-01 |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 1.25, bfloat -2.0, /* rnd=rm */ i32 3) |
| ret bfloat %res |
| } |
| |
| define bfloat @test_1_25_minus_2_rn_bf16() { |
| ; CHECK-LABEL: define bfloat @test_1_25_minus_2_rn_bf16() { |
| ; CHECK-NEXT: ret bfloat -7.500000e-01 |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 1.25, bfloat -2.0, /* rnd=rn */ i32 1) |
| ret bfloat %res |
| } |
| |
| define bfloat @test_1_25_minus_2_rp_bf16() { |
| ; CHECK-LABEL: define bfloat @test_1_25_minus_2_rp_bf16() { |
| ; CHECK-NEXT: ret bfloat -7.500000e-01 |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 1.25, bfloat -2.0, /* rnd=rp */ i32 2) |
| ret bfloat %res |
| } |
| |
| define bfloat @test_1_25_minus_2_rz_bf16() { |
| ; CHECK-LABEL: define bfloat @test_1_25_minus_2_rz_bf16() { |
| ; CHECK-NEXT: ret bfloat -7.500000e-01 |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 1.25, bfloat -2.0, /* rnd=rz */ i32 0) |
| ret bfloat %res |
| } |
| |
| ;############################################################### |
| ;# Add(0.0, NaN) # |
| ;############################################################### |
| ; Tests addition of a zero with NaN. |
| ; The result is always NaN and the operation is not constant-folded. |
| |
| define double @test_zero_plus_nan_rm_d() { |
| ; CHECK-LABEL: define double @test_zero_plus_nan_rm_d() { |
| ; CHECK-NEXT: [[RES:%.*]] = call double @llvm.nvvm.fadd.f64(double 0.000000e+00, double +snan(0x4444400000000), /* rnd=rm */ i32 3) |
| ; CHECK-NEXT: ret double [[RES]] |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 0.0, double 0x7ff4444400000000, /* rnd=rm */ i32 3) |
| ret double %res |
| } |
| |
| define double @test_zero_plus_nan_rn_d() { |
| ; CHECK-LABEL: define double @test_zero_plus_nan_rn_d() { |
| ; CHECK-NEXT: [[RES:%.*]] = call double @llvm.nvvm.fadd.f64(double 0.000000e+00, double +snan(0x4444400000000), /* rnd=rn */ i32 1) |
| ; CHECK-NEXT: ret double [[RES]] |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 0.0, double 0x7ff4444400000000, /* rnd=rn */ i32 1) |
| ret double %res |
| } |
| |
| define double @test_zero_plus_nan_rp_d() { |
| ; CHECK-LABEL: define double @test_zero_plus_nan_rp_d() { |
| ; CHECK-NEXT: [[RES:%.*]] = call double @llvm.nvvm.fadd.f64(double 0.000000e+00, double +snan(0x4444400000000), /* rnd=rp */ i32 2) |
| ; CHECK-NEXT: ret double [[RES]] |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 0.0, double 0x7ff4444400000000, /* rnd=rp */ i32 2) |
| ret double %res |
| } |
| |
| define double @test_zero_plus_nan_rz_d() { |
| ; CHECK-LABEL: define double @test_zero_plus_nan_rz_d() { |
| ; CHECK-NEXT: [[RES:%.*]] = call double @llvm.nvvm.fadd.f64(double 0.000000e+00, double +snan(0x4444400000000), /* rnd=rz */ i32 0) |
| ; CHECK-NEXT: ret double [[RES]] |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 0.0, double 0x7ff4444400000000, /* rnd=rz */ i32 0) |
| ret double %res |
| } |
| |
| define float @test_zero_plus_nan_rm_f() { |
| ; CHECK-LABEL: define float @test_zero_plus_nan_rm_f() { |
| ; CHECK-NEXT: [[RES:%.*]] = call float @llvm.nvvm.fadd.f32(float 0.000000e+00, float +nan(0x3A2220), /* rnd=rm */ i32 3) |
| ; CHECK-NEXT: ret float [[RES]] |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 0.0, float 0x7FFF444400000000, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_zero_plus_nan_rn_f() { |
| ; CHECK-LABEL: define float @test_zero_plus_nan_rn_f() { |
| ; CHECK-NEXT: [[RES:%.*]] = call float @llvm.nvvm.fadd.f32(float 0.000000e+00, float +nan(0x3A2220), /* rnd=rn */ i32 1) |
| ; CHECK-NEXT: ret float [[RES]] |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 0.0, float 0x7FFF444400000000, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_zero_plus_nan_rp_f() { |
| ; CHECK-LABEL: define float @test_zero_plus_nan_rp_f() { |
| ; CHECK-NEXT: [[RES:%.*]] = call float @llvm.nvvm.fadd.f32(float 0.000000e+00, float +nan(0x3A2220), /* rnd=rp */ i32 2) |
| ; CHECK-NEXT: ret float [[RES]] |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 0.0, float 0x7FFF444400000000, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_zero_plus_nan_rz_f() { |
| ; CHECK-LABEL: define float @test_zero_plus_nan_rz_f() { |
| ; CHECK-NEXT: [[RES:%.*]] = call float @llvm.nvvm.fadd.f32(float 0.000000e+00, float +nan(0x3A2220), /* rnd=rz */ i32 0) |
| ; CHECK-NEXT: ret float [[RES]] |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 0.0, float 0x7FFF444400000000, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| define float @test_zero_plus_nan_rm_ftz_f() { |
| ; CHECK-LABEL: define float @test_zero_plus_nan_rm_ftz_f() { |
| ; CHECK-NEXT: [[RES:%.*]] = call float @llvm.nvvm.fadd.ftz.f32(float 0.000000e+00, float +nan(0x3A2220), /* rnd=rm */ i32 3) |
| ; CHECK-NEXT: ret float [[RES]] |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 0.0, float 0x7FFF444400000000, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_zero_plus_nan_rn_ftz_f() { |
| ; CHECK-LABEL: define float @test_zero_plus_nan_rn_ftz_f() { |
| ; CHECK-NEXT: [[RES:%.*]] = call float @llvm.nvvm.fadd.ftz.f32(float 0.000000e+00, float +nan(0x3A2220), /* rnd=rn */ i32 1) |
| ; CHECK-NEXT: ret float [[RES]] |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 0.0, float 0x7FFF444400000000, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_zero_plus_nan_rp_ftz_f() { |
| ; CHECK-LABEL: define float @test_zero_plus_nan_rp_ftz_f() { |
| ; CHECK-NEXT: [[RES:%.*]] = call float @llvm.nvvm.fadd.ftz.f32(float 0.000000e+00, float +nan(0x3A2220), /* rnd=rp */ i32 2) |
| ; CHECK-NEXT: ret float [[RES]] |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 0.0, float 0x7FFF444400000000, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_zero_plus_nan_rz_ftz_f() { |
| ; CHECK-LABEL: define float @test_zero_plus_nan_rz_ftz_f() { |
| ; CHECK-NEXT: [[RES:%.*]] = call float @llvm.nvvm.fadd.ftz.f32(float 0.000000e+00, float +nan(0x3A2220), /* rnd=rz */ i32 0) |
| ; CHECK-NEXT: ret float [[RES]] |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 0.0, float 0x7FFF444400000000, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| define half @test_zero_plus_nan_rm_f16() { |
| ; CHECK-LABEL: define half @test_zero_plus_nan_rm_f16() { |
| ; CHECK-NEXT: [[RES:%.*]] = call half @llvm.nvvm.fadd.f16(half 0.000000e+00, half +qnan, /* rnd=rm */ i32 3) |
| ; CHECK-NEXT: ret half [[RES]] |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 0.0, half 0xH7E00, /* rnd=rm */ i32 3) |
| ret half %res |
| } |
| |
| define half @test_zero_plus_nan_rn_f16() { |
| ; CHECK-LABEL: define half @test_zero_plus_nan_rn_f16() { |
| ; CHECK-NEXT: [[RES:%.*]] = call half @llvm.nvvm.fadd.f16(half 0.000000e+00, half +qnan, /* rnd=rn */ i32 1) |
| ; CHECK-NEXT: ret half [[RES]] |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 0.0, half 0xH7E00, /* rnd=rn */ i32 1) |
| ret half %res |
| } |
| |
| define half @test_zero_plus_nan_rp_f16() { |
| ; CHECK-LABEL: define half @test_zero_plus_nan_rp_f16() { |
| ; CHECK-NEXT: [[RES:%.*]] = call half @llvm.nvvm.fadd.f16(half 0.000000e+00, half +qnan, /* rnd=rp */ i32 2) |
| ; CHECK-NEXT: ret half [[RES]] |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 0.0, half 0xH7E00, /* rnd=rp */ i32 2) |
| ret half %res |
| } |
| |
| define half @test_zero_plus_nan_rz_f16() { |
| ; CHECK-LABEL: define half @test_zero_plus_nan_rz_f16() { |
| ; CHECK-NEXT: [[RES:%.*]] = call half @llvm.nvvm.fadd.f16(half 0.000000e+00, half +qnan, /* rnd=rz */ i32 0) |
| ; CHECK-NEXT: ret half [[RES]] |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 0.0, half 0xH7E00, /* rnd=rz */ i32 0) |
| ret half %res |
| } |
| |
| define bfloat @test_zero_plus_nan_rm_bf16() { |
| ; CHECK-LABEL: define bfloat @test_zero_plus_nan_rm_bf16() { |
| ; CHECK-NEXT: [[RES:%.*]] = call bfloat @llvm.nvvm.fadd.bf16(bfloat 0.000000e+00, bfloat +qnan, /* rnd=rm */ i32 3) |
| ; CHECK-NEXT: ret bfloat [[RES]] |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 0.0, bfloat 0xR7FC0, /* rnd=rm */ i32 3) |
| ret bfloat %res |
| } |
| |
| define bfloat @test_zero_plus_nan_rn_bf16() { |
| ; CHECK-LABEL: define bfloat @test_zero_plus_nan_rn_bf16() { |
| ; CHECK-NEXT: [[RES:%.*]] = call bfloat @llvm.nvvm.fadd.bf16(bfloat 0.000000e+00, bfloat +qnan, /* rnd=rn */ i32 1) |
| ; CHECK-NEXT: ret bfloat [[RES]] |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 0.0, bfloat 0xR7FC0, /* rnd=rn */ i32 1) |
| ret bfloat %res |
| } |
| |
| define bfloat @test_zero_plus_nan_rp_bf16() { |
| ; CHECK-LABEL: define bfloat @test_zero_plus_nan_rp_bf16() { |
| ; CHECK-NEXT: [[RES:%.*]] = call bfloat @llvm.nvvm.fadd.bf16(bfloat 0.000000e+00, bfloat +qnan, /* rnd=rp */ i32 2) |
| ; CHECK-NEXT: ret bfloat [[RES]] |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 0.0, bfloat 0xR7FC0, /* rnd=rp */ i32 2) |
| ret bfloat %res |
| } |
| |
| define bfloat @test_zero_plus_nan_rz_bf16() { |
| ; CHECK-LABEL: define bfloat @test_zero_plus_nan_rz_bf16() { |
| ; CHECK-NEXT: [[RES:%.*]] = call bfloat @llvm.nvvm.fadd.bf16(bfloat 0.000000e+00, bfloat +qnan, /* rnd=rz */ i32 0) |
| ; CHECK-NEXT: ret bfloat [[RES]] |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 0.0, bfloat 0xR7FC0, /* rnd=rz */ i32 0) |
| ret bfloat %res |
| } |
| |
| ;############################################################### |
| ;# Add(Subnormal, Subnormal) -> Normal # |
| ;############################################################### |
| ; Tests addition of two positive subnormal numbers (2^-127) |
| ; - Without FTZ: The result is the sum of the subnormals (2^-126) - a normal number |
| ; - With FTZ: The inputs are flushed to zero, so the result is zero (despite the output being normal) |
| |
| define double @test_subnorm_plus_subnorm_to_normal_rm_d() { |
| ; CHECK-LABEL: define double @test_subnorm_plus_subnorm_to_normal_rm_d() { |
| ; CHECK-NEXT: ret double f0x3810000000000000 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 0x3800000000000000, double 0x3800000000000000, /* rnd=rm */ i32 3) |
| ret double %res |
| } |
| |
| define double @test_subnorm_plus_subnorm_to_normal_rn_d() { |
| ; CHECK-LABEL: define double @test_subnorm_plus_subnorm_to_normal_rn_d() { |
| ; CHECK-NEXT: ret double f0x3810000000000000 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 0x3800000000000000, double 0x3800000000000000, /* rnd=rn */ i32 1) |
| ret double %res |
| } |
| |
| define double @test_subnorm_plus_subnorm_to_normal_rp_d() { |
| ; CHECK-LABEL: define double @test_subnorm_plus_subnorm_to_normal_rp_d() { |
| ; CHECK-NEXT: ret double f0x3810000000000000 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 0x3800000000000000, double 0x3800000000000000, /* rnd=rp */ i32 2) |
| ret double %res |
| } |
| |
| define double @test_subnorm_plus_subnorm_to_normal_rz_d() { |
| ; CHECK-LABEL: define double @test_subnorm_plus_subnorm_to_normal_rz_d() { |
| ; CHECK-NEXT: ret double f0x3810000000000000 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 0x3800000000000000, double 0x3800000000000000, /* rnd=rz */ i32 0) |
| ret double %res |
| } |
| |
| define float @test_subnorm_plus_subnorm_to_normal_rm_f() { |
| ; CHECK-LABEL: define float @test_subnorm_plus_subnorm_to_normal_rm_f() { |
| ; CHECK-NEXT: ret float f0x00800000 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 0x3800000000000000, float 0x3800000000000000, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_subnorm_plus_subnorm_to_normal_rn_f() { |
| ; CHECK-LABEL: define float @test_subnorm_plus_subnorm_to_normal_rn_f() { |
| ; CHECK-NEXT: ret float f0x00800000 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 0x3800000000000000, float 0x3800000000000000, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_subnorm_plus_subnorm_to_normal_rp_f() { |
| ; CHECK-LABEL: define float @test_subnorm_plus_subnorm_to_normal_rp_f() { |
| ; CHECK-NEXT: ret float f0x00800000 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 0x3800000000000000, float 0x3800000000000000, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_subnorm_plus_subnorm_to_normal_rz_f() { |
| ; CHECK-LABEL: define float @test_subnorm_plus_subnorm_to_normal_rz_f() { |
| ; CHECK-NEXT: ret float f0x00800000 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 0x3800000000000000, float 0x3800000000000000, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| define float @test_subnorm_plus_subnorm_to_normal_rm_ftz_f() { |
| ; CHECK-LABEL: define float @test_subnorm_plus_subnorm_to_normal_rm_ftz_f() { |
| ; CHECK-NEXT: ret float 0.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 0x3800000000000000, float 0x3800000000000000, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_subnorm_plus_subnorm_to_normal_rn_ftz_f() { |
| ; CHECK-LABEL: define float @test_subnorm_plus_subnorm_to_normal_rn_ftz_f() { |
| ; CHECK-NEXT: ret float 0.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 0x3800000000000000, float 0x3800000000000000, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_subnorm_plus_subnorm_to_normal_rp_ftz_f() { |
| ; CHECK-LABEL: define float @test_subnorm_plus_subnorm_to_normal_rp_ftz_f() { |
| ; CHECK-NEXT: ret float 0.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 0x3800000000000000, float 0x3800000000000000, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_subnorm_plus_subnorm_to_normal_rz_ftz_f() { |
| ; CHECK-LABEL: define float @test_subnorm_plus_subnorm_to_normal_rz_ftz_f() { |
| ; CHECK-NEXT: ret float 0.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 0x3800000000000000, float 0x3800000000000000, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| define half @test_subnorm_plus_subnorm_to_normal_rm_f16() { |
| ; CHECK-LABEL: define half @test_subnorm_plus_subnorm_to_normal_rm_f16() { |
| ; CHECK-NEXT: ret half 6.103520e-05 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 0xH0200, half 0xH0200, /* rnd=rm */ i32 3) |
| ret half %res |
| } |
| |
| define half @test_subnorm_plus_subnorm_to_normal_rn_f16() { |
| ; CHECK-LABEL: define half @test_subnorm_plus_subnorm_to_normal_rn_f16() { |
| ; CHECK-NEXT: ret half 6.103520e-05 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 0xH0200, half 0xH0200, /* rnd=rn */ i32 1) |
| ret half %res |
| } |
| |
| define half @test_subnorm_plus_subnorm_to_normal_rp_f16() { |
| ; CHECK-LABEL: define half @test_subnorm_plus_subnorm_to_normal_rp_f16() { |
| ; CHECK-NEXT: ret half 6.103520e-05 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 0xH0200, half 0xH0200, /* rnd=rp */ i32 2) |
| ret half %res |
| } |
| |
| define half @test_subnorm_plus_subnorm_to_normal_rz_f16() { |
| ; CHECK-LABEL: define half @test_subnorm_plus_subnorm_to_normal_rz_f16() { |
| ; CHECK-NEXT: ret half 6.103520e-05 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 0xH0200, half 0xH0200, /* rnd=rz */ i32 0) |
| ret half %res |
| } |
| |
| define half @test_subnorm_plus_subnorm_to_normal_rm_ftz_f16() { |
| ; CHECK-LABEL: define half @test_subnorm_plus_subnorm_to_normal_rm_ftz_f16() { |
| ; CHECK-NEXT: ret half 0.000000e+00 |
| ; |
| %res = call half @llvm.nvvm.fadd.ftz.f16(half 0xH0200, half 0xH0200, /* rnd=rm */ i32 3) |
| ret half %res |
| } |
| |
| define half @test_subnorm_plus_subnorm_to_normal_rn_ftz_f16() { |
| ; CHECK-LABEL: define half @test_subnorm_plus_subnorm_to_normal_rn_ftz_f16() { |
| ; CHECK-NEXT: ret half 0.000000e+00 |
| ; |
| %res = call half @llvm.nvvm.fadd.ftz.f16(half 0xH0200, half 0xH0200, /* rnd=rn */ i32 1) |
| ret half %res |
| } |
| |
| define half @test_subnorm_plus_subnorm_to_normal_rp_ftz_f16() { |
| ; CHECK-LABEL: define half @test_subnorm_plus_subnorm_to_normal_rp_ftz_f16() { |
| ; CHECK-NEXT: ret half 0.000000e+00 |
| ; |
| %res = call half @llvm.nvvm.fadd.ftz.f16(half 0xH0200, half 0xH0200, /* rnd=rp */ i32 2) |
| ret half %res |
| } |
| |
| define half @test_subnorm_plus_subnorm_to_normal_rz_ftz_f16() { |
| ; CHECK-LABEL: define half @test_subnorm_plus_subnorm_to_normal_rz_ftz_f16() { |
| ; CHECK-NEXT: ret half 0.000000e+00 |
| ; |
| %res = call half @llvm.nvvm.fadd.ftz.f16(half 0xH0200, half 0xH0200, /* rnd=rz */ i32 0) |
| ret half %res |
| } |
| |
| define bfloat @test_subnorm_plus_subnorm_to_normal_rm_bf16() { |
| ; CHECK-LABEL: define bfloat @test_subnorm_plus_subnorm_to_normal_rm_bf16() { |
| ; CHECK-NEXT: ret bfloat 1.175490e-38 |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 0xR0040, bfloat 0xR0040, /* rnd=rm */ i32 3) |
| ret bfloat %res |
| } |
| |
| define bfloat @test_subnorm_plus_subnorm_to_normal_rn_bf16() { |
| ; CHECK-LABEL: define bfloat @test_subnorm_plus_subnorm_to_normal_rn_bf16() { |
| ; CHECK-NEXT: ret bfloat 1.175490e-38 |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 0xR0040, bfloat 0xR0040, /* rnd=rn */ i32 1) |
| ret bfloat %res |
| } |
| |
| define bfloat @test_subnorm_plus_subnorm_to_normal_rp_bf16() { |
| ; CHECK-LABEL: define bfloat @test_subnorm_plus_subnorm_to_normal_rp_bf16() { |
| ; CHECK-NEXT: ret bfloat 1.175490e-38 |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 0xR0040, bfloat 0xR0040, /* rnd=rp */ i32 2) |
| ret bfloat %res |
| } |
| |
| define bfloat @test_subnorm_plus_subnorm_to_normal_rz_bf16() { |
| ; CHECK-LABEL: define bfloat @test_subnorm_plus_subnorm_to_normal_rz_bf16() { |
| ; CHECK-NEXT: ret bfloat 1.175490e-38 |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 0xR0040, bfloat 0xR0040, /* rnd=rz */ i32 0) |
| ret bfloat %res |
| } |
| |
| ;############################################################### |
| ;# Add(Normal, -Subnormal) -> Subnormal # |
| ;############################################################### |
| ; Tests addition of 2^-126 (the smallest normal number) and -(2^-127). |
| ; - Without FTZ: The result is correctly computed as a subnormal (2^-127) |
| ; - With FTZ: The subnormal input is flushed to zero, so the result is the |
| ; normal input (2^-126) |
| |
| define double @test_normal_minus_subnorm_to_subnorm_rm_d() { |
| ; CHECK-LABEL: define double @test_normal_minus_subnorm_to_subnorm_rm_d() { |
| ; CHECK-NEXT: ret double f0x3800000000000000 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 0x3810000000000000, double 0xB800000000000000, /* rnd=rm */ i32 3) |
| ret double %res |
| } |
| |
| define double @test_normal_minus_subnorm_to_subnorm_rn_d() { |
| ; CHECK-LABEL: define double @test_normal_minus_subnorm_to_subnorm_rn_d() { |
| ; CHECK-NEXT: ret double f0x3800000000000000 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 0x3810000000000000, double 0xB800000000000000, /* rnd=rn */ i32 1) |
| ret double %res |
| } |
| |
| define double @test_normal_minus_subnorm_to_subnorm_rp_d() { |
| ; CHECK-LABEL: define double @test_normal_minus_subnorm_to_subnorm_rp_d() { |
| ; CHECK-NEXT: ret double f0x3800000000000000 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 0x3810000000000000, double 0xB800000000000000, /* rnd=rp */ i32 2) |
| ret double %res |
| } |
| |
| define double @test_normal_minus_subnorm_to_subnorm_rz_d() { |
| ; CHECK-LABEL: define double @test_normal_minus_subnorm_to_subnorm_rz_d() { |
| ; CHECK-NEXT: ret double f0x3800000000000000 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 0x3810000000000000, double 0xB800000000000000, /* rnd=rz */ i32 0) |
| ret double %res |
| } |
| |
| define float @test_normal_minus_subnorm_to_subnorm_rm_f() { |
| ; CHECK-LABEL: define float @test_normal_minus_subnorm_to_subnorm_rm_f() { |
| ; CHECK-NEXT: ret float f0x00400000 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 0x3810000000000000, float 0xB800000000000000, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_normal_minus_subnorm_to_subnorm_rn_f() { |
| ; CHECK-LABEL: define float @test_normal_minus_subnorm_to_subnorm_rn_f() { |
| ; CHECK-NEXT: ret float f0x00400000 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 0x3810000000000000, float 0xB800000000000000, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_normal_minus_subnorm_to_subnorm_rp_f() { |
| ; CHECK-LABEL: define float @test_normal_minus_subnorm_to_subnorm_rp_f() { |
| ; CHECK-NEXT: ret float f0x00400000 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 0x3810000000000000, float 0xB800000000000000, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_normal_minus_subnorm_to_subnorm_rz_f() { |
| ; CHECK-LABEL: define float @test_normal_minus_subnorm_to_subnorm_rz_f() { |
| ; CHECK-NEXT: ret float f0x00400000 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 0x3810000000000000, float 0xB800000000000000, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| define float @test_normal_minus_subnorm_to_subnorm_rm_ftz_f() { |
| ; CHECK-LABEL: define float @test_normal_minus_subnorm_to_subnorm_rm_ftz_f() { |
| ; CHECK-NEXT: ret float f0x00800000 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 0x3810000000000000, float 0xB800000000000000, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_normal_minus_subnorm_to_subnorm_rn_ftz_f() { |
| ; CHECK-LABEL: define float @test_normal_minus_subnorm_to_subnorm_rn_ftz_f() { |
| ; CHECK-NEXT: ret float f0x00800000 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 0x3810000000000000, float 0xB800000000000000, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_normal_minus_subnorm_to_subnorm_rp_ftz_f() { |
| ; CHECK-LABEL: define float @test_normal_minus_subnorm_to_subnorm_rp_ftz_f() { |
| ; CHECK-NEXT: ret float f0x00800000 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 0x3810000000000000, float 0xB800000000000000, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_normal_minus_subnorm_to_subnorm_rz_ftz_f() { |
| ; CHECK-LABEL: define float @test_normal_minus_subnorm_to_subnorm_rz_ftz_f() { |
| ; CHECK-NEXT: ret float f0x00800000 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 0x3810000000000000, float 0xB800000000000000, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| define half @test_normal_minus_subnorm_to_subnorm_rm_f16() { |
| ; CHECK-LABEL: define half @test_normal_minus_subnorm_to_subnorm_rm_f16() { |
| ; CHECK-NEXT: ret half 3.051760e-05 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 0xH0400, half 0xH8200, /* rnd=rm */ i32 3) |
| ret half %res |
| } |
| |
| define half @test_normal_minus_subnorm_to_subnorm_rn_f16() { |
| ; CHECK-LABEL: define half @test_normal_minus_subnorm_to_subnorm_rn_f16() { |
| ; CHECK-NEXT: ret half 3.051760e-05 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 0xH0400, half 0xH8200, /* rnd=rn */ i32 1) |
| ret half %res |
| } |
| |
| define half @test_normal_minus_subnorm_to_subnorm_rp_f16() { |
| ; CHECK-LABEL: define half @test_normal_minus_subnorm_to_subnorm_rp_f16() { |
| ; CHECK-NEXT: ret half 3.051760e-05 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 0xH0400, half 0xH8200, /* rnd=rp */ i32 2) |
| ret half %res |
| } |
| |
| define half @test_normal_minus_subnorm_to_subnorm_rz_f16() { |
| ; CHECK-LABEL: define half @test_normal_minus_subnorm_to_subnorm_rz_f16() { |
| ; CHECK-NEXT: ret half 3.051760e-05 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 0xH0400, half 0xH8200, /* rnd=rz */ i32 0) |
| ret half %res |
| } |
| |
| define half @test_normal_minus_subnorm_to_subnorm_rm_ftz_f16() { |
| ; CHECK-LABEL: define half @test_normal_minus_subnorm_to_subnorm_rm_ftz_f16() { |
| ; CHECK-NEXT: ret half 6.103520e-05 |
| ; |
| %res = call half @llvm.nvvm.fadd.ftz.f16(half 0xH0400, half 0xH8200, /* rnd=rm */ i32 3) |
| ret half %res |
| } |
| |
| define half @test_normal_minus_subnorm_to_subnorm_rn_ftz_f16() { |
| ; CHECK-LABEL: define half @test_normal_minus_subnorm_to_subnorm_rn_ftz_f16() { |
| ; CHECK-NEXT: ret half 6.103520e-05 |
| ; |
| %res = call half @llvm.nvvm.fadd.ftz.f16(half 0xH0400, half 0xH8200, /* rnd=rn */ i32 1) |
| ret half %res |
| } |
| |
| define half @test_normal_minus_subnorm_to_subnorm_rp_ftz_f16() { |
| ; CHECK-LABEL: define half @test_normal_minus_subnorm_to_subnorm_rp_ftz_f16() { |
| ; CHECK-NEXT: ret half 6.103520e-05 |
| ; |
| %res = call half @llvm.nvvm.fadd.ftz.f16(half 0xH0400, half 0xH8200, /* rnd=rp */ i32 2) |
| ret half %res |
| } |
| |
| define half @test_normal_minus_subnorm_to_subnorm_rz_ftz_f16() { |
| ; CHECK-LABEL: define half @test_normal_minus_subnorm_to_subnorm_rz_ftz_f16() { |
| ; CHECK-NEXT: ret half 6.103520e-05 |
| ; |
| %res = call half @llvm.nvvm.fadd.ftz.f16(half 0xH0400, half 0xH8200, /* rnd=rz */ i32 0) |
| ret half %res |
| } |
| |
| define bfloat @test_normal_minus_subnorm_to_subnorm_rm_bf16() { |
| ; CHECK-LABEL: define bfloat @test_normal_minus_subnorm_to_subnorm_rm_bf16() { |
| ; CHECK-NEXT: ret bfloat 5.877470e-39 |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 0xR0080, bfloat 0xR8040, /* rnd=rm */ i32 3) |
| ret bfloat %res |
| } |
| |
| define bfloat @test_normal_minus_subnorm_to_subnorm_rn_bf16() { |
| ; CHECK-LABEL: define bfloat @test_normal_minus_subnorm_to_subnorm_rn_bf16() { |
| ; CHECK-NEXT: ret bfloat 5.877470e-39 |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 0xR0080, bfloat 0xR8040, /* rnd=rn */ i32 1) |
| ret bfloat %res |
| } |
| |
| define bfloat @test_normal_minus_subnorm_to_subnorm_rp_bf16() { |
| ; CHECK-LABEL: define bfloat @test_normal_minus_subnorm_to_subnorm_rp_bf16() { |
| ; CHECK-NEXT: ret bfloat 5.877470e-39 |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 0xR0080, bfloat 0xR8040, /* rnd=rp */ i32 2) |
| ret bfloat %res |
| } |
| |
| define bfloat @test_normal_minus_subnorm_to_subnorm_rz_bf16() { |
| ; CHECK-LABEL: define bfloat @test_normal_minus_subnorm_to_subnorm_rz_bf16() { |
| ; CHECK-NEXT: ret bfloat 5.877470e-39 |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 0xR0080, bfloat 0xR8040, /* rnd=rz */ i32 0) |
| ret bfloat %res |
| } |
| |
| ;############################################################### |
| ;# Add(Normal, -Normal) -> Subnormal # |
| ;############################################################### |
| ; Tests addition of 1.5*(2^-126) and -(2^-126), where both inputs are normal |
| ; but the exact result is subnormal. |
| ; - Without FTZ: The result is the exact difference (2^-127) |
| ; - With FTZ: The result is flushed to zero. Flushing the inputs alone would |
| ; leave it untouched, as neither input is subnormal. |
| |
| define float @test_normal_minus_normal_to_subnorm_rm_f() { |
| ; CHECK-LABEL: define float @test_normal_minus_normal_to_subnorm_rm_f() { |
| ; CHECK-NEXT: ret float f0x00400000 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 0x3818000000000000, float 0xB810000000000000, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_normal_minus_normal_to_subnorm_rn_f() { |
| ; CHECK-LABEL: define float @test_normal_minus_normal_to_subnorm_rn_f() { |
| ; CHECK-NEXT: ret float f0x00400000 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 0x3818000000000000, float 0xB810000000000000, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_normal_minus_normal_to_subnorm_rp_f() { |
| ; CHECK-LABEL: define float @test_normal_minus_normal_to_subnorm_rp_f() { |
| ; CHECK-NEXT: ret float f0x00400000 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 0x3818000000000000, float 0xB810000000000000, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_normal_minus_normal_to_subnorm_rz_f() { |
| ; CHECK-LABEL: define float @test_normal_minus_normal_to_subnorm_rz_f() { |
| ; CHECK-NEXT: ret float f0x00400000 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 0x3818000000000000, float 0xB810000000000000, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| define float @test_normal_minus_normal_to_subnorm_rm_ftz_f() { |
| ; CHECK-LABEL: define float @test_normal_minus_normal_to_subnorm_rm_ftz_f() { |
| ; CHECK-NEXT: ret float 0.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 0x3818000000000000, float 0xB810000000000000, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_normal_minus_normal_to_subnorm_rn_ftz_f() { |
| ; CHECK-LABEL: define float @test_normal_minus_normal_to_subnorm_rn_ftz_f() { |
| ; CHECK-NEXT: ret float 0.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 0x3818000000000000, float 0xB810000000000000, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_normal_minus_normal_to_subnorm_rp_ftz_f() { |
| ; CHECK-LABEL: define float @test_normal_minus_normal_to_subnorm_rp_ftz_f() { |
| ; CHECK-NEXT: ret float 0.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 0x3818000000000000, float 0xB810000000000000, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_normal_minus_normal_to_subnorm_rz_ftz_f() { |
| ; CHECK-LABEL: define float @test_normal_minus_normal_to_subnorm_rz_ftz_f() { |
| ; CHECK-NEXT: ret float 0.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 0x3818000000000000, float 0xB810000000000000, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| define half @test_normal_minus_normal_to_subnorm_rm_f16() { |
| ; CHECK-LABEL: define half @test_normal_minus_normal_to_subnorm_rm_f16() { |
| ; CHECK-NEXT: ret half 3.051760e-05 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 0xH0600, half 0xH8400, /* rnd=rm */ i32 3) |
| ret half %res |
| } |
| |
| define half @test_normal_minus_normal_to_subnorm_rn_f16() { |
| ; CHECK-LABEL: define half @test_normal_minus_normal_to_subnorm_rn_f16() { |
| ; CHECK-NEXT: ret half 3.051760e-05 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 0xH0600, half 0xH8400, /* rnd=rn */ i32 1) |
| ret half %res |
| } |
| |
| define half @test_normal_minus_normal_to_subnorm_rp_f16() { |
| ; CHECK-LABEL: define half @test_normal_minus_normal_to_subnorm_rp_f16() { |
| ; CHECK-NEXT: ret half 3.051760e-05 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 0xH0600, half 0xH8400, /* rnd=rp */ i32 2) |
| ret half %res |
| } |
| |
| define half @test_normal_minus_normal_to_subnorm_rz_f16() { |
| ; CHECK-LABEL: define half @test_normal_minus_normal_to_subnorm_rz_f16() { |
| ; CHECK-NEXT: ret half 3.051760e-05 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 0xH0600, half 0xH8400, /* rnd=rz */ i32 0) |
| ret half %res |
| } |
| |
| define half @test_normal_minus_normal_to_subnorm_rm_ftz_f16() { |
| ; CHECK-LABEL: define half @test_normal_minus_normal_to_subnorm_rm_ftz_f16() { |
| ; CHECK-NEXT: ret half 0.000000e+00 |
| ; |
| %res = call half @llvm.nvvm.fadd.ftz.f16(half 0xH0600, half 0xH8400, /* rnd=rm */ i32 3) |
| ret half %res |
| } |
| |
| define half @test_normal_minus_normal_to_subnorm_rn_ftz_f16() { |
| ; CHECK-LABEL: define half @test_normal_minus_normal_to_subnorm_rn_ftz_f16() { |
| ; CHECK-NEXT: ret half 0.000000e+00 |
| ; |
| %res = call half @llvm.nvvm.fadd.ftz.f16(half 0xH0600, half 0xH8400, /* rnd=rn */ i32 1) |
| ret half %res |
| } |
| |
| define half @test_normal_minus_normal_to_subnorm_rp_ftz_f16() { |
| ; CHECK-LABEL: define half @test_normal_minus_normal_to_subnorm_rp_ftz_f16() { |
| ; CHECK-NEXT: ret half 0.000000e+00 |
| ; |
| %res = call half @llvm.nvvm.fadd.ftz.f16(half 0xH0600, half 0xH8400, /* rnd=rp */ i32 2) |
| ret half %res |
| } |
| |
| define half @test_normal_minus_normal_to_subnorm_rz_ftz_f16() { |
| ; CHECK-LABEL: define half @test_normal_minus_normal_to_subnorm_rz_ftz_f16() { |
| ; CHECK-NEXT: ret half 0.000000e+00 |
| ; |
| %res = call half @llvm.nvvm.fadd.ftz.f16(half 0xH0600, half 0xH8400, /* rnd=rz */ i32 0) |
| ret half %res |
| } |
| |
| ;############################################################### |
| ;# Add(1.0, 2^(-25)) # |
| ;############################################################### |
| ; Tests addition of 1.0 and 2^(-25) where the exact result falls between |
| ; 1.0 and 1.0 + 2^(-23): |
| ; - RN, RZ, RM: Return 1.0 (rounding toward nearest/zero/down) |
| ; - RP: Returns 1.0 + 2^(-23) (rounding up) |
| |
| define float @test_1_plus_ulp_rm_f() { |
| ; CHECK-LABEL: define float @test_1_plus_ulp_rm_f() { |
| ; CHECK-NEXT: ret float 1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 1.0, float 0x3E60000000000000, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_1_plus_ulp_rn_f() { |
| ; CHECK-LABEL: define float @test_1_plus_ulp_rn_f() { |
| ; CHECK-NEXT: ret float 1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 1.0, float 0x3E60000000000000, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_1_plus_ulp_rp_f() { |
| ; CHECK-LABEL: define float @test_1_plus_ulp_rp_f() { |
| ; CHECK-NEXT: ret float f0x3F800001 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 1.0, float 0x3E60000000000000, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_1_plus_ulp_rz_f() { |
| ; CHECK-LABEL: define float @test_1_plus_ulp_rz_f() { |
| ; CHECK-NEXT: ret float 1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 1.0, float 0x3E60000000000000, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| define float @test_1_plus_ulp_rm_ftz_f() { |
| ; CHECK-LABEL: define float @test_1_plus_ulp_rm_ftz_f() { |
| ; CHECK-NEXT: ret float 1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 1.0, float 0x3E60000000000000, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_1_plus_ulp_rn_ftz_f() { |
| ; CHECK-LABEL: define float @test_1_plus_ulp_rn_ftz_f() { |
| ; CHECK-NEXT: ret float 1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 1.0, float 0x3E60000000000000, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_1_plus_ulp_rp_ftz_f() { |
| ; CHECK-LABEL: define float @test_1_plus_ulp_rp_ftz_f() { |
| ; CHECK-NEXT: ret float f0x3F800001 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 1.0, float 0x3E60000000000000, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_1_plus_ulp_rz_ftz_f() { |
| ; CHECK-LABEL: define float @test_1_plus_ulp_rz_ftz_f() { |
| ; CHECK-NEXT: ret float 1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 1.0, float 0x3E60000000000000, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| ;############################################################### |
| ;# Add(1.0, 2^(-54)) # |
| ;############################################################### |
| ; Tests addition of 1.0 and 2^(-54) where the exact result falls between |
| ; 1.0 and 1.0 + 2^(-52): |
| ; - RN, RZ, RM: Return 1.0 (rounding to nearest/zero/down) |
| ; - RP: Returns 1.0 + 2^(-52) (rounding up) |
| |
| define double @test_1_plus_ulp_rm_d() { |
| ; CHECK-LABEL: define double @test_1_plus_ulp_rm_d() { |
| ; CHECK-NEXT: ret double 1.000000e+00 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 1.0, double 0x3C90000000000000, /* rnd=rm */ i32 3) |
| ret double %res |
| } |
| |
| define double @test_1_plus_ulp_rn_d() { |
| ; CHECK-LABEL: define double @test_1_plus_ulp_rn_d() { |
| ; CHECK-NEXT: ret double 1.000000e+00 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 1.0, double 0x3C90000000000000, /* rnd=rn */ i32 1) |
| ret double %res |
| } |
| |
| define double @test_1_plus_ulp_rp_d() { |
| ; CHECK-LABEL: define double @test_1_plus_ulp_rp_d() { |
| ; CHECK-NEXT: ret double f0x3FF0000000000001 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 1.0, double 0x3C90000000000000, /* rnd=rp */ i32 2) |
| ret double %res |
| } |
| |
| define double @test_1_plus_ulp_rz_d() { |
| ; CHECK-LABEL: define double @test_1_plus_ulp_rz_d() { |
| ; CHECK-NEXT: ret double 1.000000e+00 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 1.0, double 0x3C90000000000000, /* rnd=rz */ i32 0) |
| ret double %res |
| } |
| |
| ;############################################################### |
| ;# Add(1.0, 2^(-12)) # |
| ;############################################################### |
| ; Tests addition of 1.0 and 2^(-12) where the exact result falls between |
| ; 1.0 and 1.0 + 2^(-10): |
| ; - RN, RZ, RM: Return 1.0 (rounding to nearest/zero/down) |
| ; - RP: Returns 1.0 + 2^(-10) (rounding up) |
| |
| define half @test_1_plus_ulp_rm_f16() { |
| ; CHECK-LABEL: define half @test_1_plus_ulp_rm_f16() { |
| ; CHECK-NEXT: ret half 1.000000e+00 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 1.0, half 0xH0C00, /* rnd=rm */ i32 3) |
| ret half %res |
| } |
| |
| define half @test_1_plus_ulp_rn_f16() { |
| ; CHECK-LABEL: define half @test_1_plus_ulp_rn_f16() { |
| ; CHECK-NEXT: ret half 1.000000e+00 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 1.0, half 0xH0C00, /* rnd=rn */ i32 1) |
| ret half %res |
| } |
| |
| define half @test_1_plus_ulp_rp_f16() { |
| ; CHECK-LABEL: define half @test_1_plus_ulp_rp_f16() { |
| ; CHECK-NEXT: ret half 1.000980e+00 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 1.0, half 0xH0C00, /* rnd=rp */ i32 2) |
| ret half %res |
| } |
| |
| define half @test_1_plus_ulp_rz_f16() { |
| ; CHECK-LABEL: define half @test_1_plus_ulp_rz_f16() { |
| ; CHECK-NEXT: ret half 1.000000e+00 |
| ; |
| %res = call half @llvm.nvvm.fadd.f16(half 1.0, half 0xH0C00, /* rnd=rz */ i32 0) |
| ret half %res |
| } |
| |
| ;############################################################### |
| ;# Add(1.0, 2^(-9)) # |
| ;############################################################### |
| ; Tests addition of 1.0 and 2^(-9) where the exact result falls between |
| ; 1.0 and 1.0 + 2^(-7): |
| ; - RN, RZ, RM: Return 1.0 (rounding to nearest/zero/down) |
| ; - RP: Returns 1.0 + 2^(-7) (rounding up) |
| |
| define bfloat @test_1_plus_ulp_rm_bf16() { |
| ; CHECK-LABEL: define bfloat @test_1_plus_ulp_rm_bf16() { |
| ; CHECK-NEXT: ret bfloat 1.000000e+00 |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 1.0, bfloat 0xR3B00, /* rnd=rm */ i32 3) |
| ret bfloat %res |
| } |
| |
| define bfloat @test_1_plus_ulp_rn_bf16() { |
| ; CHECK-LABEL: define bfloat @test_1_plus_ulp_rn_bf16() { |
| ; CHECK-NEXT: ret bfloat 1.000000e+00 |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 1.0, bfloat 0xR3B00, /* rnd=rn */ i32 1) |
| ret bfloat %res |
| } |
| |
| define bfloat @test_1_plus_ulp_rp_bf16() { |
| ; CHECK-LABEL: define bfloat @test_1_plus_ulp_rp_bf16() { |
| ; CHECK-NEXT: ret bfloat 1.007810e+00 |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 1.0, bfloat 0xR3B00, /* rnd=rp */ i32 2) |
| ret bfloat %res |
| } |
| |
| define bfloat @test_1_plus_ulp_rz_bf16() { |
| ; CHECK-LABEL: define bfloat @test_1_plus_ulp_rz_bf16() { |
| ; CHECK-NEXT: ret bfloat 1.000000e+00 |
| ; |
| %res = call bfloat @llvm.nvvm.fadd.bf16(bfloat 1.0, bfloat 0xR3B00, /* rnd=rz */ i32 0) |
| ret bfloat %res |
| } |
| |
| ;############################################################### |
| ;# Add(-1.0, 2^(-25)) # |
| ;############################################################### |
| ; Tests addition of -1.0 and 2^(-25)) where the exact result falls between |
| ; -1.0 and -1.0 + 2^(-23): |
| ; - RN, RM: Returns -1.0 (rounding toward nearest/down) |
| ; - RZ, RP: Return -1.0 + 2^(-23) (rounding toward zero/up) |
| |
| define float @test_neg_1_plus_ulp_rm_f() { |
| ; CHECK-LABEL: define float @test_neg_1_plus_ulp_rm_f() { |
| ; CHECK-NEXT: ret float -1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float -1.0, float 0x3E60000000000000, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_neg_1_plus_ulp_rn_f() { |
| ; CHECK-LABEL: define float @test_neg_1_plus_ulp_rn_f() { |
| ; CHECK-NEXT: ret float -1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float -1.0, float 0x3E60000000000000, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_neg_1_plus_ulp_rp_f() { |
| ; CHECK-LABEL: define float @test_neg_1_plus_ulp_rp_f() { |
| ; CHECK-NEXT: ret float f0xBF7FFFFF |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float -1.0, float 0x3E60000000000000, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_neg_1_plus_ulp_rz_f() { |
| ; CHECK-LABEL: define float @test_neg_1_plus_ulp_rz_f() { |
| ; CHECK-NEXT: ret float f0xBF7FFFFF |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float -1.0, float 0x3E60000000000000, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| define float @test_neg_1_plus_ulp_rm_ftz_f() { |
| ; CHECK-LABEL: define float @test_neg_1_plus_ulp_rm_ftz_f() { |
| ; CHECK-NEXT: ret float -1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float -1.0, float 0x3E60000000000000, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_neg_1_plus_ulp_rn_ftz_f() { |
| ; CHECK-LABEL: define float @test_neg_1_plus_ulp_rn_ftz_f() { |
| ; CHECK-NEXT: ret float -1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float -1.0, float 0x3E60000000000000, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_neg_1_plus_ulp_rp_ftz_f() { |
| ; CHECK-LABEL: define float @test_neg_1_plus_ulp_rp_ftz_f() { |
| ; CHECK-NEXT: ret float f0xBF7FFFFF |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float -1.0, float 0x3E60000000000000, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_neg_1_plus_ulp_rz_ftz_f() { |
| ; CHECK-LABEL: define float @test_neg_1_plus_ulp_rz_ftz_f() { |
| ; CHECK-NEXT: ret float f0xBF7FFFFF |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float -1.0, float 0x3E60000000000000, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| ;############################################################### |
| ;# Add(-1.0, 2^(-54)) # |
| ;############################################################### |
| ; Tests addition of -1.0 and 2^(-54) where the exact result falls between |
| ; -1.0 and -1.0 + 2^(-52): |
| ; - RN, RM: Return -1.0 (rounding toward nearest/down) |
| ; - RZ, RP: Return -1.0 + 2^(-52) (rounding toward zero/up) |
| |
| define double @test_neg_1_plus_ulp_rm_d() { |
| ; CHECK-LABEL: define double @test_neg_1_plus_ulp_rm_d() { |
| ; CHECK-NEXT: ret double -1.000000e+00 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double -1.0, double 0x3C90000000000000, /* rnd=rm */ i32 3) |
| ret double %res |
| } |
| |
| define double @test_neg_1_plus_ulp_rn_d() { |
| ; CHECK-LABEL: define double @test_neg_1_plus_ulp_rn_d() { |
| ; CHECK-NEXT: ret double -1.000000e+00 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double -1.0, double 0x3C90000000000000, /* rnd=rn */ i32 1) |
| ret double %res |
| } |
| |
| define double @test_neg_1_plus_ulp_rp_d() { |
| ; CHECK-LABEL: define double @test_neg_1_plus_ulp_rp_d() { |
| ; CHECK-NEXT: ret double f0xBFEFFFFFFFFFFFFF |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double -1.0, double 0x3C90000000000000, /* rnd=rp */ i32 2) |
| ret double %res |
| } |
| |
| define double @test_neg_1_plus_ulp_rz_d() { |
| ; CHECK-LABEL: define double @test_neg_1_plus_ulp_rz_d() { |
| ; CHECK-NEXT: ret double f0xBFEFFFFFFFFFFFFF |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double -1.0, double 0x3C90000000000000, /* rnd=rz */ i32 0) |
| ret double %res |
| } |
| |
| ;############################################################### |
| ;# Add(1.0, -2^(-25)) # |
| ;############################################################### |
| ; Tests addition of 1.0 and -2^(-25) where the exact result falls between |
| ; 1.0 and 1.0 - 2^(-23): |
| ; - RN, RP: Return 1.0 (rounding toward nearest/up) |
| ; - RZ, RM: Return 1.0 - 2^(-23) (rounding toward zero/down) |
| |
| define float @test_1_minus_ulp_rm_f() { |
| ; CHECK-LABEL: define float @test_1_minus_ulp_rm_f() { |
| ; CHECK-NEXT: ret float f0x3F7FFFFF |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 1.0, float 0xBE60000000000000, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_1_minus_ulp_rn_f() { |
| ; CHECK-LABEL: define float @test_1_minus_ulp_rn_f() { |
| ; CHECK-NEXT: ret float 1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 1.0, float 0xBE60000000000000, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_1_minus_ulp_rp_f() { |
| ; CHECK-LABEL: define float @test_1_minus_ulp_rp_f() { |
| ; CHECK-NEXT: ret float 1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 1.0, float 0xBE60000000000000, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_1_minus_ulp_rz_f() { |
| ; CHECK-LABEL: define float @test_1_minus_ulp_rz_f() { |
| ; CHECK-NEXT: ret float f0x3F7FFFFF |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float 1.0, float 0xBE60000000000000, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| define float @test_1_minus_ulp_rm_ftz_f() { |
| ; CHECK-LABEL: define float @test_1_minus_ulp_rm_ftz_f() { |
| ; CHECK-NEXT: ret float f0x3F7FFFFF |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 1.0, float 0xBE60000000000000, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_1_minus_ulp_rn_ftz_f() { |
| ; CHECK-LABEL: define float @test_1_minus_ulp_rn_ftz_f() { |
| ; CHECK-NEXT: ret float 1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 1.0, float 0xBE60000000000000, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_1_minus_ulp_rp_ftz_f() { |
| ; CHECK-LABEL: define float @test_1_minus_ulp_rp_ftz_f() { |
| ; CHECK-NEXT: ret float 1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 1.0, float 0xBE60000000000000, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_1_minus_ulp_rz_ftz_f() { |
| ; CHECK-LABEL: define float @test_1_minus_ulp_rz_ftz_f() { |
| ; CHECK-NEXT: ret float f0x3F7FFFFF |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float 1.0, float 0xBE60000000000000, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| ;############################################################### |
| ;# Add(1.0, -2^(-54)) # |
| ;############################################################### |
| ; Tests addition of 1.0 and -2^(-54) where the exact result falls between |
| ; 1.0 and 1.0 - 2^(-52): |
| ; - RN, RP: Return 1.0 (rounding toward nearest/up) |
| ; - RZ, RM: Return 1.0 - 2^(-52) (rounding toward zero/down) |
| |
| define double @test_1_minus_ulp_rm_d() { |
| ; CHECK-LABEL: define double @test_1_minus_ulp_rm_d() { |
| ; CHECK-NEXT: ret double f0x3FEFFFFFFFFFFFFF |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 1.0, double 0xBC90000000000000, /* rnd=rm */ i32 3) |
| ret double %res |
| } |
| |
| define double @test_1_minus_ulp_rn_d() { |
| ; CHECK-LABEL: define double @test_1_minus_ulp_rn_d() { |
| ; CHECK-NEXT: ret double 1.000000e+00 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 1.0, double 0xBC90000000000000, /* rnd=rn */ i32 1) |
| ret double %res |
| } |
| |
| define double @test_1_minus_ulp_rp_d() { |
| ; CHECK-LABEL: define double @test_1_minus_ulp_rp_d() { |
| ; CHECK-NEXT: ret double 1.000000e+00 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 1.0, double 0xBC90000000000000, /* rnd=rp */ i32 2) |
| ret double %res |
| } |
| |
| define double @test_1_minus_ulp_rz_d() { |
| ; CHECK-LABEL: define double @test_1_minus_ulp_rz_d() { |
| ; CHECK-NEXT: ret double f0x3FEFFFFFFFFFFFFF |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double 1.0, double 0xBC90000000000000, /* rnd=rz */ i32 0) |
| ret double %res |
| } |
| |
| ;############################################################### |
| ;# Add(-1.0, -2^(-25)) # |
| ;############################################################### |
| ; Tests addition of -1.0 and -2^(-25) where the exact result falls between |
| ; -1.0 and -1.0 - 2^(-23): |
| ; - RN, RZ, RP: Return -1.0 (rounding to nearest/zero/up) |
| ; - RM: Return -1.0 - 2^(-23) (rounding down) |
| |
| define float @test_neg_1_minus_ulp_rm_f() { |
| ; CHECK-LABEL: define float @test_neg_1_minus_ulp_rm_f() { |
| ; CHECK-NEXT: ret float f0xBF800001 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float -1.0, float 0xBE60000000000000, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_neg_1_minus_ulp_rn_f() { |
| ; CHECK-LABEL: define float @test_neg_1_minus_ulp_rn_f() { |
| ; CHECK-NEXT: ret float -1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float -1.0, float 0xBE60000000000000, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_neg_1_minus_ulp_rp_f() { |
| ; CHECK-LABEL: define float @test_neg_1_minus_ulp_rp_f() { |
| ; CHECK-NEXT: ret float -1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float -1.0, float 0xBE60000000000000, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_neg_1_minus_ulp_rz_f() { |
| ; CHECK-LABEL: define float @test_neg_1_minus_ulp_rz_f() { |
| ; CHECK-NEXT: ret float -1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.f32(float -1.0, float 0xBE60000000000000, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| define float @test_neg_1_minus_ulp_rm_ftz_f() { |
| ; CHECK-LABEL: define float @test_neg_1_minus_ulp_rm_ftz_f() { |
| ; CHECK-NEXT: ret float f0xBF800001 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float -1.0, float 0xBE60000000000000, /* rnd=rm */ i32 3) |
| ret float %res |
| } |
| |
| define float @test_neg_1_minus_ulp_rn_ftz_f() { |
| ; CHECK-LABEL: define float @test_neg_1_minus_ulp_rn_ftz_f() { |
| ; CHECK-NEXT: ret float -1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float -1.0, float 0xBE60000000000000, /* rnd=rn */ i32 1) |
| ret float %res |
| } |
| |
| define float @test_neg_1_minus_ulp_rp_ftz_f() { |
| ; CHECK-LABEL: define float @test_neg_1_minus_ulp_rp_ftz_f() { |
| ; CHECK-NEXT: ret float -1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float -1.0, float 0xBE60000000000000, /* rnd=rp */ i32 2) |
| ret float %res |
| } |
| |
| define float @test_neg_1_minus_ulp_rz_ftz_f() { |
| ; CHECK-LABEL: define float @test_neg_1_minus_ulp_rz_ftz_f() { |
| ; CHECK-NEXT: ret float -1.000000e+00 |
| ; |
| %res = call float @llvm.nvvm.fadd.ftz.f32(float -1.0, float 0xBE60000000000000, /* rnd=rz */ i32 0) |
| ret float %res |
| } |
| |
| ;############################################################### |
| ;# Add(-1.0, -2^(-54)) # |
| ;############################################################### |
| ; Tests addition of -1.0 and -2^(-54) where the exact result falls between |
| ; -1.0 and -1.0 - 2^(-52): |
| ; - RN, RZ, RP: Return -1.0 (rounding to nearest/zero/up) |
| ; - RM: Return -1.0 - 2^(-52) (rounding down) |
| |
| define double @test_neg_1_minus_ulp_rm_d() { |
| ; CHECK-LABEL: define double @test_neg_1_minus_ulp_rm_d() { |
| ; CHECK-NEXT: ret double f0xBFF0000000000001 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double -1.0, double 0xBC90000000000000, /* rnd=rm */ i32 3) |
| ret double %res |
| } |
| |
| define double @test_neg_1_minus_ulp_rn_d() { |
| ; CHECK-LABEL: define double @test_neg_1_minus_ulp_rn_d() { |
| ; CHECK-NEXT: ret double -1.000000e+00 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double -1.0, double 0xBC90000000000000, /* rnd=rn */ i32 1) |
| ret double %res |
| } |
| |
| define double @test_neg_1_minus_ulp_rp_d() { |
| ; CHECK-LABEL: define double @test_neg_1_minus_ulp_rp_d() { |
| ; CHECK-NEXT: ret double -1.000000e+00 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double -1.0, double 0xBC90000000000000, /* rnd=rp */ i32 2) |
| ret double %res |
| } |
| |
| define double @test_neg_1_minus_ulp_rz_d() { |
| ; CHECK-LABEL: define double @test_neg_1_minus_ulp_rz_d() { |
| ; CHECK-NEXT: ret double -1.000000e+00 |
| ; |
| %res = call double @llvm.nvvm.fadd.f64(double -1.0, double 0xBC90000000000000, /* rnd=rz */ i32 0) |
| ret double %res |
| } |