llvm-project/llvm/test/CodeGen/AArch64/GlobalISel/combine-fconstant.mir

75 lines
2.5 KiB
YAML

# 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: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1028443341
; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 524
; CHECK: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C1]](s64)
; CHECK: G_STORE [[C]](s32), [[PTR_ADD]](p0) :: (store 4)
; CHECK: 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 4)
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: %ptr:_(p0) = COPY $x0
; CHECK: %c:_(s64) = G_CONSTANT i64 0
; CHECK: G_STORE %c(s64), %ptr(p0) :: (store 8)
; CHECK: RET_ReallyLR
%ptr:_(p0) = COPY $x0
%c:_(s64) = G_FCONSTANT double 0.0
G_STORE %c(s64), %ptr(p0) :: (store 8)
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: %v:_(s64) = COPY $x0
; CHECK: %c:_(s64) = G_FCONSTANT double 0.000000e+00
; CHECK: %add:_(s64) = G_FADD %v, %c
; CHECK: 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
...