[llvm-commits] [test-suite] r155493 - in /test-suite/trunk/SingleSource/Regression/C: compare.c compare.reference_output

Bill Wendling isanbard at gmail.com
Tue Apr 24 14:56:30 PDT 2012


Author: void
Date: Tue Apr 24 16:56:29 2012
New Revision: 155493

URL: http://llvm.org/viewvc/llvm-project?rev=155493&view=rev
Log:
This test is primarily for ARM:

Verify that comparison between immediates and INT32_MIN behave correctly no
matter which side the immediate is on in the comparison.
<rdar://problem/11232451>

Added:
    test-suite/trunk/SingleSource/Regression/C/compare.c
    test-suite/trunk/SingleSource/Regression/C/compare.reference_output

Added: test-suite/trunk/SingleSource/Regression/C/compare.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Regression/C/compare.c?rev=155493&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Regression/C/compare.c (added)
+++ test-suite/trunk/SingleSource/Regression/C/compare.c Tue Apr 24 16:56:29 2012
@@ -0,0 +1,34 @@
+#include <stdint.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+int test_1(int ly) __attribute__((noinline));
+int test_1(int ly) {
+  if (ly <= INT32_MIN)
+    ly = INT32_MIN + 1;
+
+  return ly;
+}
+
+int test_2(int ly) __attribute__((noinline));
+int test_2(int ly) {
+  if (INT32_MIN >= ly)
+    ly = INT32_MIN + 1;
+
+  return ly;
+}
+
+int main () {
+  int x = 37;
+
+  printf ("x = %d (0x%x)\n", x, x);
+
+  int r1 = test_1(x);
+  printf ("test_1(x) = %d (0x%x)\n", r1, r1);
+
+  int r2 = test_2(x);
+  printf ("test_2(x) = %d (0x%x)\n", r2, r2);
+
+  return 0;
+}

Added: test-suite/trunk/SingleSource/Regression/C/compare.reference_output
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Regression/C/compare.reference_output?rev=155493&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Regression/C/compare.reference_output (added)
+++ test-suite/trunk/SingleSource/Regression/C/compare.reference_output Tue Apr 24 16:56:29 2012
@@ -0,0 +1,4 @@
+x = 37 (0x25)
+test_1(x) = 37 (0x25)
+test_2(x) = 37 (0x25)
+exit 0





More information about the llvm-commits mailing list