Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions llvm/test/CodeGen/AMDGPU/twoaddr-fma-f64.mir
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ body: |
...

# GCN-LABEL: name: test_fmaak_sgpr_src0_f64
# GCN: V_FMA_F64_e64 0, killed %0, 0, %1, 0, %2:vreg_64_align2, 0, 0, implicit $mode, implicit $exec
# GCN: V_FMA_F64_e64 0, killed %0, 0, %1, 0, %2, 0, 0, implicit $mode, implicit $exec

---
name: test_fmaak_sgpr_src0_f64
Expand All @@ -70,12 +70,13 @@ body: |

%0 = IMPLICIT_DEF
%1 = V_MOV_B64_PSEUDO 4607182418800017408, implicit $exec
%2 = IMPLICIT_DEF
%3 = V_FMAC_F64_e32 killed %0, %1, %2, implicit $mode, implicit $exec

...

# GCN-LABEL: name: test_fmaak_inlineimm_src0_f64
# GCN: V_FMA_F64_e64 0, 4611686018427387904, 0, %0, 0, %1:vreg_64_align2, 0, 0, implicit $mode, implicit $exec
# GCN: V_FMA_F64_e64 0, 4611686018427387904, 0, %0, 0, %1, 0, 0, implicit $mode, implicit $exec

---
name: test_fmaak_inlineimm_src0_f64
Expand All @@ -87,6 +88,7 @@ body: |
bb.0:

%0 = V_MOV_B64_PSEUDO 4607182418800017408, implicit $exec
%1 = IMPLICIT_DEF
%2 = V_FMAC_F64_e32 4611686018427387904, %0, %1, implicit $mode, implicit $exec

...
Expand All @@ -104,6 +106,7 @@ body: |
bb.0:

%0 = V_MOV_B64_PSEUDO 4607182418800017408, implicit $exec
%1 = IMPLICIT_DEF
%2 = V_FMAC_F64_e32 4636737291354636288, %0, %1, implicit $mode, implicit $exec

...
Expand All @@ -124,6 +127,7 @@ body: |
bb.0:

%0 = V_MOV_B64_PSEUDO 4607182418800017408, implicit $exec
%1 = IMPLICIT_DEF
%2 = V_FMAC_F64_e32 %stack.0, %0, %1, implicit $mode, implicit $exec

...
Expand Down
24 changes: 12 additions & 12 deletions llvm/test/CodeGen/AMDGPU/twoaddr-mad.mir
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ body: |

# GCN-LABEL: name: test_madak_sgpr_src0_f32
# GCN: %1:vgpr_32 = V_MOV_B32_e32 1078523331, implicit $exec
# GCN: %2:vgpr_32 = V_MAD_F32_e64 0, killed %0, 0, %1, 0, %3:vgpr_32, 0, 0, implicit $mode, implicit $exec
# GCN: %3:vgpr_32 = V_MAD_F32_e64 0, killed %0, 0, %1, 0, %2, 0, 0, implicit $mode, implicit $exec

---
name: test_madak_sgpr_src0_f32
Expand All @@ -127,14 +127,15 @@ body: |

%0 = IMPLICIT_DEF
%1 = V_MOV_B32_e32 1078523331, implicit $exec
%2 = V_MAC_F32_e32 killed %0, %1, %3, implicit $mode, implicit $exec
%2 = IMPLICIT_DEF
%3 = V_MAC_F32_e32 killed %0, %1, %2, implicit $mode, implicit $exec
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMPLICIT_DEF isn't really representative of running twoaddrs, which runs after ProcessImplicitDefs. Better to have an undef operand

I don't want to do that because changing the third operand in this case to be undef changes the behaviour of twoaddrs - it now tries to convert this MAC to a MAD, and the same for a bunch of other cases.

I could use a real instruction instead of IMPLICIT_DEF if that's preferable?


...

# This can still fold if this is an inline immediate.

# GCN-LABEL: name: test_madak_inlineimm_src0_f32
# GCN: %1:vgpr_32 = V_MADMK_F32 1073741824, 1078523331, %2:vgpr_32, implicit $mode, implicit $exec
# GCN: %2:vgpr_32 = V_MADMK_F32 1073741824, 1078523331, %1, implicit $mode, implicit $exec

---
name: test_madak_inlineimm_src0_f32
Expand All @@ -146,13 +147,14 @@ body: |
bb.0:

%0 = V_MOV_B32_e32 1078523331, implicit $exec
%1 = V_MAC_F32_e32 1073741824, %0, %2, implicit $mode, implicit $exec
%1 = IMPLICIT_DEF
%2 = V_MAC_F32_e32 1073741824, %0, %1, implicit $mode, implicit $exec

...
# Non-inline immediate uses constant bus already.

# GCN-LABEL: name: test_madak_otherimm_src0_f32
# GCN: %1:vgpr_32 = V_MADMK_F32 %0, 1120403456, %2:vgpr_32, implicit $mode, implicit $exec
# GCN: %2:vgpr_32 = V_MADMK_F32 %0, 1120403456, %1, implicit $mode, implicit $exec

---
name: test_madak_otherimm_src0_f32
Expand All @@ -164,13 +166,14 @@ body: |
bb.0:

%0 = V_MOV_B32_e32 1078523331, implicit $exec
%1 = V_MAC_F32_e32 1120403456, %0, %2, implicit $mode, implicit $exec
%1 = IMPLICIT_DEF
%2 = V_MAC_F32_e32 1120403456, %0, %1, implicit $mode, implicit $exec

...
# Non-inline immediate uses constant bus already.

# GCN-LABEL: name: test_madak_other_constantlike_src0_f32
# GCN: %1:vgpr_32 = V_MAC_F32_e32 %stack.0, %0, %1, implicit $mode, implicit $exec
# GCN: %2:vgpr_32 = V_MAC_F32_e32 %stack.0, %0, %2, implicit $mode, implicit $exec
---
name: test_madak_other_constantlike_src0_f32
registers:
Expand All @@ -185,7 +188,8 @@ body: |
bb.0:

%0 = V_MOV_B32_e32 1078523331, implicit $exec
%1 = V_MAC_F32_e32 %stack.0, %0, %2, implicit $mode, implicit $exec
%1 = IMPLICIT_DEF
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMPLICIT_DEF isn't really representative of running twoaddrs, which runs after ProcessImplicitDefs. Better to have an undef operand

%2 = V_MAC_F32_e32 %stack.0, %0, %1, implicit $mode, implicit $exec

...

Expand All @@ -194,12 +198,8 @@ body: |

---
name: test_madak_inline_literal_f16
liveins:
- { reg: '$vgpr0', virtual-reg: '%3' }
body: |
bb.0:
liveins: $vgpr0

%3:vgpr_32 = COPY killed $vgpr0

%26:vgpr_32 = V_MOV_B32_e32 49664, implicit $exec
Expand Down