# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn -mcpu=gfx1150 -verify-machineinstrs -run-pass=si-fold-operands %s -o - | FileCheck %s
---
name: fmac_fold_inlinable_src0_to_fmamk
tracksRegLiveness: true
body: |
bb.0:
liveins: $sgpr0, $sgpr1
; CHECK-LABEL: name: fmac_fold_inlinable_src0_to_fmamk
; CHECK: liveins: $sgpr0, $sgpr1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
; CHECK-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
; CHECK-NEXT: %fma:sreg_32 = nofpexcept S_FMAMK_F32 [[COPY]], 1056964608, [[COPY1]], implicit $mode
; CHECK-NEXT: $sgpr0 = COPY %fma
%0:sreg_32 = COPY $sgpr0
%1:sreg_32 = COPY $sgpr1
%inlinable:sreg_32 = S_MOV_B32 1056964608
%fma:sreg_32 = nofpexcept S_FMAC_F32 %inlinable, %0, %1, implicit $mode
$sgpr0 = COPY %fma
...
---
name: fmac_fold_inlinable_src1_to_fmamk
tracksRegLiveness: true
body: |
bb.0:
liveins: $sgpr0, $sgpr1
; CHECK-LABEL: name: fmac_fold_inlinable_src1_to_fmamk
; CHECK: liveins: $sgpr0, $sgpr1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
; CHECK-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
; CHECK-NEXT: %fma:sreg_32 = nofpexcept S_FMAMK_F32 [[COPY]], 1056964608, [[COPY1]], implicit $mode
; CHECK-NEXT: $sgpr0 = COPY %fma
%0:sreg_32 = COPY $sgpr0
%1:sreg_32 = COPY $sgpr1
%inlinable:sreg_32 = S_MOV_B32 1056964608
%fma:sreg_32 = nofpexcept S_FMAC_F32 %0, %inlinable, %1, implicit $mode
$sgpr0 = COPY %fma
...
---
name: fmac_fold_inlinable_src2_to_fmaak
tracksRegLiveness: true
body: |
bb.0:
liveins: $sgpr0, $sgpr1
; CHECK-LABEL: name: fmac_fold_inlinable_src2_to_fmaak
; CHECK: liveins: $sgpr0, $sgpr1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
; CHECK-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
; CHECK-NEXT: %fma:sreg_32 = nofpexcept S_FMAAK_F32 [[COPY]], [[COPY1]], 1056964608, implicit $mode
; CHECK-NEXT: $sgpr0 = COPY %fma
%0:sreg_32 = COPY $sgpr0
%1:sreg_32 = COPY $sgpr1
%inlinable:sreg_32 = S_MOV_B32 1056964608
%fma:sreg_32 = nofpexcept S_FMAC_F32 %0, %1, %inlinable, implicit $mode
$sgpr0 = COPY %fma
...
---
name: fmac_fold_noninlinable_src0_to_fmamk
tracksRegLiveness: true
body: |
bb.0:
liveins: $sgpr0, $sgpr1
; CHECK-LABEL: name: fmac_fold_noninlinable_src0_to_fmamk
; CHECK: liveins: $sgpr0, $sgpr1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
; CHECK-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
; CHECK-NEXT: %fma:sreg_32 = nofpexcept S_FMAMK_F32 [[COPY]], 1234567890, [[COPY1]], implicit $mode
; CHECK-NEXT: $sgpr0 = COPY %fma
%0:sreg_32 = COPY $sgpr0
%1:sreg_32 = COPY $sgpr1
%noninlinable:sreg_32 = S_MOV_B32 1234567890
%fma:sreg_32 = nofpexcept S_FMAC_F32 %noninlinable, %0, %1, implicit $mode
$sgpr0 = COPY %fma
...
---
name: fmac_fold_noninlinable_src1_to_fmamk
tracksRegLiveness: true
body: |
bb.0:
liveins: $sgpr0, $sgpr1
; CHECK-LABEL: name: fmac_fold_noninlinable_src1_to_fmamk
; CHECK: liveins: $sgpr0, $sgpr1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
; CHECK-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
; CHECK-NEXT: %fma:sreg_32 = nofpexcept S_FMAMK_F32 [[COPY]], 1234567890, [[COPY1]], implicit $mode
; CHECK-NEXT: $sgpr0 = COPY %fma
%0:sreg_32 = COPY $sgpr0
%1:sreg_32 = COPY $sgpr1
%noninlinable:sreg_32 = S_MOV_B32 1234567890
%fma:sreg_32 = nofpexcept S_FMAC_F32 %0, %noninlinable, %1, implicit $mode
$sgpr0 = COPY %fma
...
---
name: fmac_fold_noninlinable_src2_to_fmaak
tracksRegLiveness: true
body: |
bb.0:
liveins: $sgpr0, $sgpr1
; CHECK-LABEL: name: fmac_fold_noninlinable_src2_to_fmaak
; CHECK: liveins: $sgpr0, $sgpr1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
; CHECK-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
; CHECK-NEXT: %fma:sreg_32 = nofpexcept S_FMAAK_F32 [[COPY]], [[COPY1]], 1234567890, implicit $mode
; CHECK-NEXT: $sgpr0 = COPY %fma
%0:sreg_32 = COPY $sgpr0
%1:sreg_32 = COPY $sgpr1
%noninlinable:sreg_32 = S_MOV_B32 1234567890
%fma:sreg_32 = nofpexcept S_FMAC_F32 %0, %1, %noninlinable, implicit $mode
$sgpr0 = COPY %fma
...
---
name: fmac_fold_inlinable_src2_to_fmaak_noninlinable_src0_to_fmamk
tracksRegLiveness: true
body: |
bb.0:
liveins: $sgpr0
; CHECK-LABEL: name: fmac_fold_inlinable_src2_to_fmaak_noninlinable_src0_to_fmamk
; CHECK: liveins: $sgpr0
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
; CHECK-NEXT: %fma:sreg_32 = nofpexcept S_FMAMK_F32 [[COPY]], 1234567890, 1056964608, implicit $mode
; CHECK-NEXT: $sgpr0 = COPY %fma
%0:sreg_32 = COPY $sgpr0
%inlinable:sreg_32 = S_MOV_B32 1056964608
%noninlinable:sreg_32 = S_MOV_B32 1234567890
%fma:sreg_32 = nofpexcept S_FMAC_F32 %noninlinable, %0, %inlinable, implicit $mode
$sgpr0 = COPY %fma
...
---
name: fmac_fold_inlinable_src2_to_fmaak_noninlinable_src1_to_fmamk
tracksRegLiveness: true
body: |
bb.0:
liveins: $sgpr0
; CHECK-LABEL: name: fmac_fold_inlinable_src2_to_fmaak_noninlinable_src1_to_fmamk
; CHECK: liveins: $sgpr0
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
; CHECK-NEXT: %fma:sreg_32 = nofpexcept S_FMAMK_F32 [[COPY]], 1234567890, 1056964608, implicit $mode
; CHECK-NEXT: $sgpr0 = COPY %fma
%0:sreg_32 = COPY $sgpr0
%inlinable:sreg_32 = S_MOV_B32 1056964608
%noninlinable:sreg_32 = S_MOV_B32 1234567890
%fma:sreg_32 = nofpexcept S_FMAC_F32 %0, %noninlinable, %inlinable, implicit $mode
$sgpr0 = COPY %fma
...
---
name: fmac_fold_noninlinable_src2_to_fmaak_inlinable_src1
tracksRegLiveness: true
body: |
bb.0:
liveins: $sgpr0
; CHECK-LABEL: name: fmac_fold_noninlinable_src2_to_fmaak_inlinable_src1
; CHECK: liveins: $sgpr0
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
; CHECK-NEXT: %fma:sreg_32 = nofpexcept S_FMAAK_F32 [[COPY]], 1056964608, 1234567890, implicit $mode
; CHECK-NEXT: $sgpr0 = COPY %fma
%0:sreg_32 = COPY $sgpr0
%noninlinable:sreg_32 = S_MOV_B32 1234567890
%inlinable:sreg_32 = S_MOV_B32 1056964608
%fma:sreg_32 = nofpexcept S_FMAC_F32 %0, %inlinable, %noninlinable, implicit $mode
$sgpr0 = COPY %fma
...
---
name: fmac_fold_noninlinable_src2_to_fmaak_dont_fold_other_noninlinable
tracksRegLiveness: true
body: |
bb.0:
liveins: $sgpr0
; CHECK-LABEL: name: fmac_fold_noninlinable_src2_to_fmaak_dont_fold_other_noninlinable
; CHECK: liveins: $sgpr0
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
; CHECK-NEXT: %noninlinable2:sreg_32 = S_MOV_B32 1234567891
; CHECK-NEXT: %fma:sreg_32 = nofpexcept S_FMAAK_F32 [[COPY]], %noninlinable2, 1234567890, implicit $mode
; CHECK-NEXT: $sgpr0 = COPY %fma
%0:sreg_32 = COPY $sgpr0
%noninlinable:sreg_32 = S_MOV_B32 1234567890
%noninlinable2:sreg_32 = S_MOV_B32 1234567891
%fma:sreg_32 = nofpexcept S_FMAC_F32 %0, %noninlinable2, %noninlinable, implicit $mode
$sgpr0 = COPY %fma
...
---
name: fmac_fold_inlinable_src1_to_fmamk_noninlinable_src2_to_fmaak
tracksRegLiveness: true
body: |
bb.0:
liveins: $sgpr0
; CHECK-LABEL: name: fmac_fold_inlinable_src1_to_fmamk_noninlinable_src2_to_fmaak
; CHECK: liveins: $sgpr0
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
; CHECK-NEXT: %fma:sreg_32 = nofpexcept S_FMAAK_F32 [[COPY]], 1056964608, 1234567890, implicit $mode
; CHECK-NEXT: $sgpr0 = COPY %fma
%0:sreg_32 = COPY $sgpr0
%inlinable:sreg_32 = S_MOV_B32 1056964608
%noninlinable:sreg_32 = S_MOV_B32 1234567890
%fma:sreg_32 = nofpexcept S_FMAC_F32 %0, %inlinable, %noninlinable, implicit $mode
$sgpr0 = COPY %fma
...
---
name: fmac_fold_same_noninlinable_src0_and_src1_to_fmamk
tracksRegLiveness: true
body: |
bb.0:
liveins: $sgpr0
; CHECK-LABEL: name: fmac_fold_same_noninlinable_src0_and_src1_to_fmamk
; CHECK: liveins: $sgpr0
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
; CHECK-NEXT: %fma:sreg_32 = nofpexcept S_FMAMK_F32 1234567890, 1234567890, [[COPY]], implicit $mode
; CHECK-NEXT: $sgpr0 = COPY %fma
%0:sreg_32 = COPY $sgpr0
%noninlinable:sreg_32 = S_MOV_B32 1234567890
%fma:sreg_32 = nofpexcept S_FMAC_F32 %noninlinable, %noninlinable, %0, implicit $mode
$sgpr0 = COPY %fma
...