wazevo(arm64): do not optimize out Ireduce (#1760)

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
This commit is contained in:
Takeshi Yoneda
2023-10-05 15:20:35 +09:00
committed by GitHub
parent 35b1bfea31
commit a2f9cd32b7
2 changed files with 10 additions and 1 deletions

View File

@@ -835,7 +835,9 @@ func (i *instruction) asVecRRR(op vecOp, rd, rn, rm operand, arr vecArrangement)
func (i *instruction) isCopy() bool {
op := i.kind
return op == mov64 || op == mov32 || op == fpuMov64 || op == fpuMov128
// We do not include mov32 as it is not a copy instruction in the sense that it does not preserve the upper 32 bits,
// and it is only used in the translation of IReduce, not the actual copy indeed.
return op == mov64 || op == fpuMov64 || op == fpuMov128
}
// String implements fmt.Stringer.

View File

@@ -67,3 +67,10 @@ func TestInstruction_String(t *testing.T) {
t.Run(tc.exp, func(t *testing.T) { require.Equal(t, tc.exp, tc.i.String()) })
}
}
func TestInstruction_isCopy(t *testing.T) {
require.False(t, (&instruction{kind: mov32}).isCopy())
require.True(t, (&instruction{kind: mov64}).isCopy())
require.True(t, (&instruction{kind: fpuMov64}).isCopy())
require.True(t, (&instruction{kind: fpuMov128}).isCopy())
}