From: Joel Sing Date: Mon, 24 Feb 2025 12:24:42 +0000 (+1100) Subject: test/codegen: add a test for negation and conversion to int32 X-Git-Tag: go1.25rc1~701 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a8f2e63f2f5b661418f1e386e443e48356e72c40;p=gostls13.git test/codegen: add a test for negation and conversion to int32 Codify the current code generation used on riscv64 in this case. Change-Id: If4152e3652fc19d0aa28b79dba08abee2486d5ae Reviewed-on: https://go-review.googlesource.com/c/go/+/652317 Reviewed-by: Mark Ryan Reviewed-by: Meng Zhuo Reviewed-by: Cherry Mui Reviewed-by: David Chase LUCI-TryBot-Result: Go LUCI --- diff --git a/test/codegen/arithmetic.go b/test/codegen/arithmetic.go index 67bc88b587..beeb5357c4 100644 --- a/test/codegen/arithmetic.go +++ b/test/codegen/arithmetic.go @@ -173,6 +173,12 @@ func AddAddSubSimplify(a, b, c int) int { return r } +func NegToInt32(a int) int { + // riscv64: "NEG","MOVW" + r := int(int32(-a)) + return r +} + // -------------------- // // Multiplication // // -------------------- //