MIR Serialization: Change MIR syntax - use custom syntax for MBBs.
[oota-llvm.git] / test / CodeGen / MIR / NVPTX / floating-point-immediate-operands.mir
1 # RUN: llc -march=nvptx -mcpu=sm_20 -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s
2 # This test ensures that the MIR parser parses floating point constant operands
3 # correctly.
4
5 --- |
6
7   define float @test(float %k, i32 %i) {
8   entry:
9     %0 = fpext float %k to double
10     %1 = fadd double %0, 3.250000e+00
11     %2 = fptrunc double %1 to float
12     %3 = sitofp i32 %i to float
13     %4 = fadd float %3, 6.250000e+00
14     %5 = fmul float %4, %2
15     ret float %5
16   }
17
18   define float @test2(float %k, i32 %i) {
19   entry:
20     %0 = fpext float %k to double
21     %1 = fadd double %0, 0x7FF8000000000000
22     %2 = fptrunc double %1 to float
23     %3 = sitofp i32 %i to float
24     %4 = fadd float %3, 0x7FF8000000000000
25     %5 = fmul float %4, %2
26     ret float %5
27   }
28
29 ...
30 ---
31 name:            test
32 registers:
33   - { id: 0, class: float32regs }
34   - { id: 1, class: float64regs }
35   - { id: 2, class: int32regs }
36   - { id: 3, class: float64regs }
37   - { id: 4, class: float32regs }
38   - { id: 5, class: float32regs }
39   - { id: 6, class: float32regs }
40   - { id: 7, class: float32regs }
41 body: |
42   bb.0.entry:
43     %0 = LD_f32_avar 0, 4, 1, 2, 32, $test_param_0
44     %1 = CVT_f64_f32 %0, 0
45     %2 = LD_i32_avar 0, 4, 1, 0, 32, $test_param_1
46   ; CHECK: %3 = FADD_rnf64ri %1, double 3.250000e+00
47     %3 = FADD_rnf64ri %1, double 3.250000e+00
48     %4 = CVT_f32_f64 %3, 5
49     %5 = CVT_f32_s32 %2, 5
50   ; CHECK: %6 = FADD_rnf32ri %5, float 6.250000e+00
51     %6 = FADD_rnf32ri %5, float 6.250000e+00
52     %7 = FMUL_rnf32rr %6, %4
53     StoreRetvalF32 %7, 0
54     Return
55 ...
56 ---
57 name:            test2
58 registers:
59   - { id: 0, class: float32regs }
60   - { id: 1, class: float64regs }
61   - { id: 2, class: int32regs }
62   - { id: 3, class: float64regs }
63   - { id: 4, class: float32regs }
64   - { id: 5, class: float32regs }
65   - { id: 6, class: float32regs }
66   - { id: 7, class: float32regs }
67 body: |
68   bb.0.entry:
69     %0 = LD_f32_avar 0, 4, 1, 2, 32, $test2_param_0
70     %1 = CVT_f64_f32 %0, 0
71     %2 = LD_i32_avar 0, 4, 1, 0, 32, $test2_param_1
72   ; CHECK: %3 = FADD_rnf64ri %1, double 0x7FF8000000000000
73     %3 = FADD_rnf64ri %1, double 0x7FF8000000000000
74     %4 = CVT_f32_f64 %3, 5
75     %5 = CVT_f32_s32 %2, 5
76   ; CHECK: %6 = FADD_rnf32ri %5, float 0x7FF8000000000000
77     %6 = FADD_rnf32ri %5, float 0x7FF8000000000000
78     %7 = FMUL_rnf32rr %6, %4
79     StoreRetvalF32 %7, 0
80     Return
81 ...