summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/mips/truncate-6.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/mips/truncate-6.c')
-rw-r--r--gcc/testsuite/gcc.target/mips/truncate-6.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/mips/truncate-6.c b/gcc/testsuite/gcc.target/mips/truncate-6.c
new file mode 100644
index 00000000000..1ccd6c59c3d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/truncate-6.c
@@ -0,0 +1,12 @@
+/* setup_incoming_promotions should detect x to be already sign-extended due
+ to PROMOTE_MODE. Thus the truncation should be removed by combine. Based
+ on gcc.c-torture/execute/pr34070-2.c. */
+/* { dg-options "-O -mgp64" } */
+/* { dg-final { scan-assembler-not "\tsll\t\[^\n\]*,0" } } */
+
+NOMIPS16 int f(unsigned int x, int n, int *p)
+{
+ if (p)
+ *p = 1;
+ return ((int)x) / (1 << n);
+}