llvm/llvm/test/CodeGen/AMDGPU/GlobalISel/postlegalizer-combiner-fcanonicalize.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs -o - %s | FileCheck %s

---
name: test_fcanonicalize_fcanonicalize_s32
tracksRegLiveness: true
legalized: true
body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: test_fcanonicalize_fcanonicalize_s32
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %src0:_(s32) = COPY $vgpr0
    ; CHECK-NEXT: %fcanonicalize0:_(s32) = G_FCANONICALIZE %src0
    ; CHECK-NEXT: %ptr:_(p1) = G_IMPLICIT_DEF
    ; CHECK-NEXT: G_STORE %fcanonicalize0(s32), %ptr(p1) :: (store (s32), addrspace 1)
    %src0:_(s32) = COPY $vgpr0
    %fcanonicalize0:_(s32) = G_FCANONICALIZE %src0
    %fcanonicalize1:_(s32) = G_FCANONICALIZE %fcanonicalize0
    %ptr:_(p1) = G_IMPLICIT_DEF
    G_STORE %fcanonicalize1, %ptr :: (store (s32), addrspace 1, align 4)
...

---
name: test_fcanonicalize_fcanonicalize_fcanonicalize_s32
tracksRegLiveness: true
legalized: true
body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: test_fcanonicalize_fcanonicalize_fcanonicalize_s32
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %src0:_(s32) = COPY $vgpr0
    ; CHECK-NEXT: %fcanonicalize0:_(s32) = G_FCANONICALIZE %src0
    ; CHECK-NEXT: %ptr:_(p1) = G_IMPLICIT_DEF
    ; CHECK-NEXT: G_STORE %fcanonicalize0(s32), %ptr(p1) :: (store (s32), addrspace 1)
    %src0:_(s32) = COPY $vgpr0
    %fcanonicalize0:_(s32) = G_FCANONICALIZE %src0
    %fcanonicalize1:_(s32) = G_FCANONICALIZE %fcanonicalize0
    %fcanonicalize2:_(s32) = G_FCANONICALIZE %fcanonicalize1
    %ptr:_(p1) = G_IMPLICIT_DEF
    G_STORE %fcanonicalize2, %ptr :: (store (s32), addrspace 1, align 4)
...

---
name: test_fcanonicalize_fcanonicalize_s32_multi_use
tracksRegLiveness: true
legalized: true
body: |
  bb.0:
    liveins: $vgpr0

    ; CHECK-LABEL: name: test_fcanonicalize_fcanonicalize_s32_multi_use
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %src0:_(s32) = COPY $vgpr0
    ; CHECK-NEXT: %ptr:_(p1) = G_IMPLICIT_DEF
    ; CHECK-NEXT: %fcanonicalize0:_(s32) = G_FCANONICALIZE %src0
    ; CHECK-NEXT: G_STORE %fcanonicalize0(s32), %ptr(p1) :: (volatile store (s32), addrspace 1)
    ; CHECK-NEXT: G_STORE %fcanonicalize0(s32), %ptr(p1) :: (volatile store (s32), addrspace 1)
    ; CHECK-NEXT: G_STORE %fcanonicalize0(s32), %ptr(p1) :: (volatile store (s32), addrspace 1)
    %src0:_(s32) = COPY $vgpr0
    %ptr:_(p1) = G_IMPLICIT_DEF

    %fcanonicalize0:_(s32) = G_FCANONICALIZE %src0
    G_STORE %fcanonicalize0, %ptr :: (volatile store (s32), addrspace 1, align 4)

    %fcanonicalize1:_(s32) = G_FCANONICALIZE %fcanonicalize0
    G_STORE %fcanonicalize1, %ptr :: (volatile store (s32), addrspace 1, align 4)

    G_STORE %fcanonicalize1, %ptr :: (volatile store (s32), addrspace 1, align 4)
...

---
name: test_fcanonicalize_copy_fcanonicalize_s32
tracksRegLiveness: true
legalized: true
body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: test_fcanonicalize_copy_fcanonicalize_s32
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %src0:_(s32) = COPY $vgpr0
    ; CHECK-NEXT: %fcanonicalize0:_(s32) = G_FCANONICALIZE %src0
    ; CHECK-NEXT: %ptr:_(p1) = G_IMPLICIT_DEF
    ; CHECK-NEXT: G_STORE %fcanonicalize0(s32), %ptr(p1) :: (store (s32), addrspace 1)
    %src0:_(s32) = COPY $vgpr0
    %fcanonicalize0:_(s32) = G_FCANONICALIZE %src0
    %copy:_(s32) = COPY %fcanonicalize0
    %fcanonicalize1:_(s32) = G_FCANONICALIZE %copy
    %ptr:_(p1) = G_IMPLICIT_DEF
    G_STORE %fcanonicalize1, %ptr :: (store (s32), addrspace 1, align 4)
...