aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/codegen/arithmetic.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/codegen/arithmetic.go b/test/codegen/arithmetic.go
index f8a2fc5400..a5a317b2d1 100644
--- a/test/codegen/arithmetic.go
+++ b/test/codegen/arithmetic.go
@@ -789,3 +789,34 @@ func Uint64Max(a, b uint64) uint64 {
// riscv64/rva22u64,riscv64/rva23u64:"MAXU"
return max(a, b)
}
+
+// PPC64x: Canonicalization of uint8/uint16 logical immediates
+func U16And(v uint16) uint16 {
+ // ppc64x:"ANDCC [$]32768" -"MOVD"
+ return v & (1 << 15)
+}
+
+func U16Or(v uint16) uint16 {
+ // ppc64x:"OR[I]? [$]32768" -"MOVD"
+ return v | (1 << 15)
+}
+
+func U16Xor(v uint16) uint16 {
+ // ppc64x:"XOR[I]? [$]32768" -"MOVD"
+ return v ^ (1 << 15)
+}
+
+func U8And(v uint8) uint8 {
+ // ppc64x:"ANDCC [$]128" -"MOVD"
+ return v & (1 << 7)
+}
+
+func U8Or(v uint8) uint8 {
+ // ppc64x:"OR[I]? [$]128" -"MOVD"
+ return v | (1 << 7)
+}
+
+func U8Xor(v uint8) uint8 {
+ // ppc64x:"XOR[I]? [$]128" -"MOVD"
+ return v ^ (1 << 7)
+}