[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] tests: 68-truncate-shift. Fix asm syntax for RISC-V
From: |
Ekaitz Zarraga |
Subject: |
[PATCH] tests: 68-truncate-shift. Fix asm syntax for RISC-V |
Date: |
Mon, 22 Jan 2024 00:38:09 +0100 |
RISC-V uses # as a comment.
* lib/tests/scaffold/68-truncate-shift.c: Replace `asm` calls' comment
symbol with `#` in RISC-V.
---
lib/tests/scaffold/68-truncate-shift.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/lib/tests/scaffold/68-truncate-shift.c
b/lib/tests/scaffold/68-truncate-shift.c
index f766eee1..2c34c240 100644
--- a/lib/tests/scaffold/68-truncate-shift.c
+++ b/lib/tests/scaffold/68-truncate-shift.c
@@ -29,28 +29,53 @@ main ()
eputs (ntoab (a, 16, 1));
eputs ("\n");
+#if __riscv
+ asm ("#//b = a << 20;");
+#else
asm (";;//b = a << 20;");
+#endif
int b = a << 20;
+#if __riscv
+ asm ("#//print b;");
+#else
asm (";;//print b;");
+#endif
eputs ("b=");
eputs (ntoab (b, 16, 1));
eputs ("\n");
if (b != 0x100000)
return 1;
+#if __riscv
+ asm ("#//c = b >> 20;");
+#else
asm (";;//c = b >> 20;");
+#endif
int c = b >> 20;;
+#if __riscv
+ asm ("#//print c;");
+#else
asm (";;//print c;");
+#endif
eputs ("c=");
eputs (ntoab (c, 16, 1));
eputs ("\n");
if (c != 1)
return 2;
+#if __riscv
+ asm ("#//x = a << 20 >> 20;");
+#else
asm (";;//x = a << 20 >> 20;");
+#endif
int x = a << 20 >> 20;
// printf ("x=%d\n", x);
+
+#if __riscv
+ asm ("#//print x;");
+#else
asm (";;//print x;");
+#endif
eputs ("x=");
eputs (ntoab (x, 16, 1));
eputs ("\n");
--
2.41.0