test/codegen: add riscv64 checks for conditional subtractions
Add riscv64 asmcheck coverage for the conditional subtraction cases in condmove.go.
Verify that rva20u64 and rva22u64 keep using the existing SNEZ/NEG/AND/OR sequence. Verify that rva23u64 uses CZERONEZ/CZEROEQZ/OR without the older fallback sequence.
diff --git a/test/codegen/condmove.go b/test/codegen/condmove.go
index 8366961..17d0f99 100644
--- a/test/codegen/condmove.go
+++ b/test/codegen/condmove.go
@@ -857,6 +857,8 @@
const q = 8380417 // 2²³ - 2¹³ + 1
// FIXME: the compiler struggles with Sub32 since it's not intriscified.
x, b := bits.Sub32(a, q, 0)
+ // riscv64/rva20u64,riscv64/rva22u64:"SNEZ" "NEG" "AND" "OR"
+ // riscv64/rva23u64:"CZERONEZ" "CZEROEQZ" "OR" -"SNEZ" -"NEG" -"AND"
return uint32(subtle.ConstantTimeSelect(int(b), int(a), int(x)))
}
@@ -872,5 +874,7 @@
// amd64:"SUB" -"TEST" -"SBB"
x, b := bits.Sub64(uint64(a), q, 0)
// amd64:"CMOV" -"TEST" -"SBB"
+ // riscv64/rva20u64,riscv64/rva22u64:"SNEZ" "NEG" "AND" "OR"
+ // riscv64/rva23u64:"CZERONEZ" "CZEROEQZ" "OR" -"SNEZ" -"NEG" -"AND"
return uint32(subtle.ConstantTimeSelect(int(b), int(a), int(x)))
}
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
| Code-Review | +2 |
| Commit-Queue | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
Is this meant to be a blocking comment?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +2 |
Michael PrattI think zicond requires zkt to be const time
Is this meant to be a blocking comment?
Yes, I've already drop the auto submit label.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +0 |
| Hold | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Thanks. I think this is OK for the rva23u64 asmcheck because RVA23U64 mandates both Zkt and Zicond. The Zicond spec gives data-independent timing for CZERO.* when Zkt is implemented, and this test only expects CZERO.* for rva23u64; rva20u64/rva22u64 still check the non-Zicond sequence.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Michael PrattI think zicond requires zkt to be const time
Meng ZhuoIs this meant to be a blocking comment?
Yes, I've already drop the auto submit label.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
test/codegen: add riscv64 checks for conditional subtractions
Add riscv64 asmcheck coverage for the conditional subtraction cases in condmove.go.
Verify that rva20u64 and rva22u64 keep using the existing SNEZ/NEG/AND/OR sequence. Verify that rva23u64 uses CZERONEZ/CZEROEQZ/OR without the older fallback sequence.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |