summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/aarch64/builtin-bswap-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/aarch64/builtin-bswap-2.c')
-rw-r--r--gcc/testsuite/gcc.target/aarch64/builtin-bswap-2.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/aarch64/builtin-bswap-2.c b/gcc/testsuite/gcc.target/aarch64/builtin-bswap-2.c
new file mode 100644
index 00000000000..6018b483479
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/builtin-bswap-2.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* { dg-final { scan-assembler-times "rev16\\t" 2 } } */
+
+/* rev16 */
+unsigned short
+swapu16_1 (unsigned short x)
+{
+ return (x << 8) | (x >> 8);
+}
+
+/* rev16 */
+unsigned short
+swapu16_2 (unsigned short x)
+{
+ return (x >> 8) | (x << 8);
+}