File: combine-fconstant.mir

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (77 lines) | stat: -rw-r--r-- 2,680 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs -mtriple aarch64-unknown-unknown %s -o - | FileCheck %s
# RUN: llc -debugify-and-strip-all-safe -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs -mtriple aarch64-unknown-unknown %s -o - | FileCheck %s
...
---
name:            fconstant_to_constant_s32
alignment:       4
tracksRegLiveness: true
frameInfo:
  maxAlignment:    1
machineFunctionInfo: {}
body:             |
  bb.0:
    liveins: $x0
    ; Only feeding into stores here. Also, the value can't be materialized using
    ; fmov, so it's strictly better to use a mov.
    ; CHECK-LABEL: name: fconstant_to_constant_s32
    ; CHECK: liveins: $x0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1028443341
    ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 524
    ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C1]](s64)
    ; CHECK-NEXT: G_STORE [[C]](s32), [[PTR_ADD]](p0) :: (store (s32))
    ; CHECK-NEXT: RET_ReallyLR
    %0:_(p0) = COPY $x0
    %3:_(s32) = G_FCONSTANT float 0x3FA99999A0000000
    %1:_(s64) = G_CONSTANT i64 524
    %2:_(p0) = G_PTR_ADD %0, %1(s64)
    G_STORE %3(s32), %2(p0) :: (store (s32))
    RET_ReallyLR
...
---
name:            fconstant_to_constant_s64
alignment:       4
tracksRegLiveness: true
frameInfo:
  maxAlignment:    1
machineFunctionInfo: {}
body:             |
  bb.0:
    liveins: $x0
    ; CHECK-LABEL: name: fconstant_to_constant_s64
    ; CHECK: liveins: $x0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %ptr:_(p0) = COPY $x0
    ; CHECK-NEXT: %c:_(s64) = G_CONSTANT i64 0
    ; CHECK-NEXT: G_STORE %c(s64), %ptr(p0) :: (store (s64))
    ; CHECK-NEXT: RET_ReallyLR
    %ptr:_(p0) = COPY $x0
    %c:_(s64) = G_FCONSTANT double 0.0
    G_STORE %c(s64), %ptr(p0) :: (store (s64))
    RET_ReallyLR
...
---
name:            no_store_means_no_combine
alignment:       4
tracksRegLiveness: true
frameInfo:
  maxAlignment:    1
machineFunctionInfo: {}
body:             |
  bb.0:
    liveins: $x0, $x1
    ; When we aren't feeding into a store, the combine shouldn't happen.
    ; CHECK-LABEL: name: no_store_means_no_combine
    ; CHECK: liveins: $x0, $x1
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %v:_(s64) = COPY $x0
    ; CHECK-NEXT: %c:_(s64) = G_FCONSTANT double 0.000000e+00
    ; CHECK-NEXT: %add:_(s64) = G_FADD %v, %c
    ; CHECK-NEXT: RET_ReallyLR implicit %add(s64)
    %v:_(s64) = COPY $x0
    %c:_(s64) = G_FCONSTANT double 0.0
    %add:_(s64) = G_FADD %v, %c
    RET_ReallyLR implicit %add
...