• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -instcombine -S < %s | FileCheck %s
2
3declare float @llvm.AMDGPU.rcp.f32(float) nounwind readnone
4declare double @llvm.AMDGPU.rcp.f64(double) nounwind readnone
5
6; CHECK-LABEL: @test_constant_fold_rcp_f32_1
7; CHECK-NEXT: ret float 1.000000e+00
8define float @test_constant_fold_rcp_f32_1() nounwind {
9  %val = call float @llvm.AMDGPU.rcp.f32(float 1.0) nounwind readnone
10  ret float %val
11}
12
13; CHECK-LABEL: @test_constant_fold_rcp_f64_1
14; CHECK-NEXT:  ret double 1.000000e+00
15define double @test_constant_fold_rcp_f64_1() nounwind {
16  %val = call double @llvm.AMDGPU.rcp.f64(double 1.0) nounwind readnone
17  ret double %val
18}
19
20; CHECK-LABEL: @test_constant_fold_rcp_f32_half
21; CHECK-NEXT: ret float 2.000000e+00
22define float @test_constant_fold_rcp_f32_half() nounwind {
23  %val = call float @llvm.AMDGPU.rcp.f32(float 0.5) nounwind readnone
24  ret float %val
25}
26
27; CHECK-LABEL: @test_constant_fold_rcp_f64_half
28; CHECK-NEXT:  ret double 2.000000e+00
29define double @test_constant_fold_rcp_f64_half() nounwind {
30  %val = call double @llvm.AMDGPU.rcp.f64(double 0.5) nounwind readnone
31  ret double %val
32}
33
34; CHECK-LABEL: @test_constant_fold_rcp_f32_43
35; CHECK-NEXT: call float @llvm.AMDGPU.rcp.f32(float 4.300000e+01)
36define float @test_constant_fold_rcp_f32_43() nounwind {
37 %val = call float @llvm.AMDGPU.rcp.f32(float 4.300000e+01) nounwind readnone
38 ret float %val
39}
40
41; CHECK-LABEL: @test_constant_fold_rcp_f64_43
42; CHECK-NEXT: call double @llvm.AMDGPU.rcp.f64(double 4.300000e+01)
43define double @test_constant_fold_rcp_f64_43() nounwind {
44  %val = call double @llvm.AMDGPU.rcp.f64(double 4.300000e+01) nounwind readnone
45  ret double %val
46}
47
48