summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/rx/pr83831.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/rx/pr83831.c')
-rw-r--r--gcc/testsuite/gcc.target/rx/pr83831.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/rx/pr83831.c b/gcc/testsuite/gcc.target/rx/pr83831.c
new file mode 100644
index 00000000000..27d4a89cff4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/rx/pr83831.c
@@ -0,0 +1,79 @@
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+/* { dg-final { scan-assembler-times "bclr" 6 } } */
+/* { dg-final { scan-assembler-times "bset" 7 } } */
+/* { dg-final { scan-assembler-times "bnot" 7 } } */
+
+void
+test_0 (char* x, unsigned int y)
+{
+ /* Expect 4x bclr here. */
+ x[0] &= 0xFE;
+ x[1] = y & ~(1 << 1);
+ x[2] &= 0xFE;
+ x[65000] &= 0xFE;
+}
+
+unsigned int
+test_1 (unsigned int x, unsigned int y)
+{
+ /* Expect 1x bclr here. */
+ return x & ~(1 << y);
+}
+
+unsigned int
+test_2 (unsigned int x)
+{
+ /* Expect 1x bclr here. */
+ return x & ~(1 << 1);
+}
+
+void
+test_3 (char* x, unsigned int y, unsigned int z)
+{
+ /* Expect 5x bset here. */
+ x[0] |= 0x10;
+ x[1] = y | (1 << 1);
+ x[2] |= 0x10;
+ x[65000] |= 0x10;
+ x[5] |= 1 << z;
+}
+
+unsigned int
+test_4 (unsigned int x, unsigned int y)
+{
+ /* Expect 1x bset here. */
+ return x | (1 << y);
+}
+
+unsigned int
+test_5 (unsigned int x)
+{
+ /* Expect 1x bset here. */
+ return x | (1 << 8);
+}
+
+void
+test_6 (char* x, unsigned int y, unsigned int z)
+{
+ /* Expect 5x bnot here. */
+ x[0] ^= 0x10;
+ x[1] = y ^ (1 << 1);
+ x[2] ^= 0x10;
+ x[65000] ^= 0x10;
+ x[5] ^= 1 << z;
+}
+
+unsigned int
+test_7 (unsigned int x, unsigned int y)
+{
+ /* Expect 1x bnot here. */
+ return x ^ (1 << y);
+}
+
+unsigned int
+test_8 (unsigned int x)
+{
+ /* Expect 1x bnot here. */
+ return x ^ (1 << 8);
+}