1 ; RUN: opt -instcombine -S < %s | FileCheck %s
3 declare float @llvm.AMDGPU.rcp.f32(float) nounwind readnone
4 declare double @llvm.AMDGPU.rcp.f64(double) nounwind readnone
6 ; CHECK-LABEL: @test_constant_fold_rcp_f32_1
7 ; CHECK-NEXT: ret float 1.000000e+00
8 define float @test_constant_fold_rcp_f32_1() nounwind {
9 %val = call float @llvm.AMDGPU.rcp.f32(float 1.0) nounwind readnone
13 ; CHECK-LABEL: @test_constant_fold_rcp_f64_1
14 ; CHECK-NEXT: ret double 1.000000e+00
15 define double @test_constant_fold_rcp_f64_1() nounwind {
16 %val = call double @llvm.AMDGPU.rcp.f64(double 1.0) nounwind readnone
20 ; CHECK-LABEL: @test_constant_fold_rcp_f32_half
21 ; CHECK-NEXT: ret float 2.000000e+00
22 define float @test_constant_fold_rcp_f32_half() nounwind {
23 %val = call float @llvm.AMDGPU.rcp.f32(float 0.5) nounwind readnone
27 ; CHECK-LABEL: @test_constant_fold_rcp_f64_half
28 ; CHECK-NEXT: ret double 2.000000e+00
29 define double @test_constant_fold_rcp_f64_half() nounwind {
30 %val = call double @llvm.AMDGPU.rcp.f64(double 0.5) nounwind readnone
34 ; CHECK-LABEL: @test_constant_fold_rcp_f32_43
35 ; CHECK-NEXT: call float @llvm.AMDGPU.rcp.f32(float 4.300000e+01)
36 define float @test_constant_fold_rcp_f32_43() nounwind {
37 %val = call float @llvm.AMDGPU.rcp.f32(float 4.300000e+01) nounwind readnone
41 ; CHECK-LABEL: @test_constant_fold_rcp_f64_43
42 ; CHECK-NEXT: call double @llvm.AMDGPU.rcp.f64(double 4.300000e+01)
43 define double @test_constant_fold_rcp_f64_43() nounwind {
44 %val = call double @llvm.AMDGPU.rcp.f64(double 4.300000e+01) nounwind readnone