Skip to contentSkip to conversation

Travis tweaks and tcg test fixes

PATCH In review Alex Bennée 2 participants 6 messages Oct 9, 2018

lore
Share & tools
lore
#0 lore raw

v2 cover Travis tweaks and tcg test fixes

Hi,

The new patches fix the building the i386 tests when clang is the system compiler. All currently need review.

Alex Bennée (2):
.travis.yml: split MacOSX builds and reduce target list tests/tcg: disable enterN insn tests for test-i386 with clang

Theodore Dubois (1):
tests/tcg: make test-i386 test program compile on clang

 .travis.yml                |  8 +++++++-
 tests/tcg/i386/test-i386.c | 22 ++++++++++++++++++----
 2 files changed, 25 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/3 .travis.yml: split MacOSX builds and reduce target list

We have reached the point where the MacOSX build was regularly timing out. So as before I've reduced the target list to "major" architectures to try and bring the build time down. I've added an additional MacOSX build with the latest XCode with a minimal list of "most likely" targets on MacOS.

---
 .travis.yml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
.travis.yml +7 -1
index 95be6ec59f..13a09facd3 100644
@@ -107,8 +107,14 @@ matrix:
     - env: CONFIG="--disable-tcg"
            TEST_CMD=""
       compiler: gcc
-    - env: CONFIG=""
+    # MacOSX builds
+    - env: CONFIG="--target-list=aarch64-softmmu,arm-softmmu,i386-softmmu,mips-softmmu,mips64-softmmu,ppc64-softmmu,riscv64-softmmu,s390x-softmmu,x86_64-softmmu"
       os: osx
+      osx_image: xcode9.4
+      compiler: clang
+    - env: CONFIG="--target-list=i386-softmmu,ppc-softmmu,ppc64-softmmu,m68k-softmmu,x86_64-softmmu"
+      os: osx
+      osx_image: xcode10
       compiler: clang
     # Python builds
     - env: CONFIG="--target-list=x86_64-softmmu"
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/3 tests/tcg: make test-i386 test program compile on clang

In reply to Alex Bennée

From: Theodore Dubois <[email protected]>

Clang's assembler is slightly incompatible with GCC's assembler, which caused the program to not compile on Clang for these reasons:

- The "q" constraint was specified for an argument to the set instruction, which didn't work because Clang chose the esi register, which has no 8-bit form on i386.
- Clang doesn't support size suffixes on the loop instructions.

    https://bugs.llvm.org/show_bug.cgi?id=33741
  - Clang requires a size suffix on the fist instruction.
  - Clang doesn't support specifying segment prefixes before the
    instruction, and requires specifying them on the address.
  - The arguments to the bound instruction are in the wrong order on
    Clang. https://bugs.llvm.org/show_bug.cgi?id=27653
[AJB: tweaked title, add bugref]
---
 tests/tcg/i386/test-i386.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
tests/tcg/i386/test-i386.c +16 -4
index a29b41e764..c5f67000e4 100644
@@ -368,7 +368,7 @@ void test_lea(void)
     asm("movl $0, %0\n\t"\
         "cmpl %2, %1\n\t"\
         "set" JCC " %b0\n\t"\
-        : "=r" (res)\
+        : "=q" (res)\
         : "r" (v1), "r" (v2));\
     printf("%-10s %d\n", "set" JCC, res);\
  if (TEST_CMOV) {\
@@ -490,15 +490,23 @@ void test_loop(void)
 
 #if !defined(__x86_64__)
     TEST_LOOP("jcxz");
+#if !defined(__clang__)
     TEST_LOOP("loopw");
     TEST_LOOP("loopzw");
     TEST_LOOP("loopnzw");
+#endif
 #endif
 
     TEST_LOOP("jecxz");
+#if !defined(__clang__)
     TEST_LOOP("loopl");
     TEST_LOOP("loopzl");
     TEST_LOOP("loopnzl");
+#else
+    TEST_LOOP("loop");
+    TEST_LOOP("loopz");
+    TEST_LOOP("loopnz");
+#endif
 }
 
 #undef CC_MASK
@@ -866,7 +874,7 @@ void test_fcvt(double a)
         uint16_t val16;
         val16 = (fpuc & ~0x0c00) | (i << 10);
         asm volatile ("fldcw %0" : : "m" (val16));
-        asm volatile ("fist %0" : "=m" (wa) : "t" (a));
+        asm volatile ("fists %0" : "=m" (wa) : "t" (a));
         asm volatile ("fistl %0" : "=m" (ia) : "t" (a));
         asm volatile ("fistpll %0" : "=m" (lla) : "t" (a) : "st");
         asm volatile ("frndint ; fstl %0" : "=m" (ra) : "t" (a));
@@ -1317,12 +1325,12 @@ void test_segs(void)
     seg_data1[1] = 0xaa;
     seg_data2[1] = 0x55;
 
-    asm volatile ("fs movzbl 0x1, %0" : "=r" (res));
+    asm volatile ("movzbl %%fs:0x1, %0" : "=r" (res));
     printf("FS[1] = %02x\n", res);
 
     asm volatile ("pushl %%gs\n"
                   "movl %1, %%gs\n"
-                  "gs movzbl 0x1, %0\n"
+                  "movzbl %%gs:0x1, %0\n"
                   "popl %%gs\n"
                   : "=r" (res)
                   : "r" (MK_SEL(2)));
@@ -1763,7 +1771,11 @@ void test_exceptions(void)
         /* bound exception */
         tab[0] = 1;
         tab[1] = 10;
+#if defined(__clang__)
+        asm volatile ("bound %1, %0" : : "r" (11), "m" (tab[0]));
+#else
         asm volatile ("bound %0, %1" : : "r" (11), "m" (tab[0]));
+#endif
     }
 #endif
 
Signature · 1 line
2.17.1
#3 lore raw

PATCH v2 3/3 tests/tcg: disable enterN insn tests for test-i386 with clang

In reply to Alex Bennée

The enter[qwl] instructions aren't supported by clang's inline assembler. Apply the hammer to work around it when we re-use our system compiler to build tcg tests.

---
 tests/tcg/i386/test-i386.c | 2 ++
 1 file changed, 2 insertions(+)
tests/tcg/i386/test-i386.c +2 -0
index c5f67000e4..da632c9b67 100644
@@ -2098,6 +2098,7 @@ long enter_stack[4096];
 
 static void test_enter(void)
 {
+#if !(defined __clang__)
 #if defined(__x86_64__)
     TEST_ENTER("q", uint64_t, 0);
     TEST_ENTER("q", uint64_t, 1);
@@ -2114,6 +2115,7 @@ static void test_enter(void)
     TEST_ENTER("w", uint16_t, 1);
     TEST_ENTER("w", uint16_t, 2);
     TEST_ENTER("w", uint16_t, 31);
+#endif
 }
 
 #ifdef TEST_SSE
Signature · 1 line
2.17.1
#4 lore raw

Re: [Qemu-devel] [PATCH v2 3/3] tests/tcg: disable enterN insn tests for test-i386 with clang

Quoted 5 lines · Alex Bennée

The enter[qwl] instructions aren't supported by clang's inline assembler. Apply the hammer to work around it when we re-use our system compiler to build tcg tests.

Do you have a bug for this in llvm? It doesn't seem to be a good idea.

Paolo

Quoted 25 lines
---
 tests/tcg/i386/test-i386.c | 2 ++
 1 file changed, 2 insertions(+)
tests/tcg/i386/test-i386.c +2 -0
index c5f67000e4..da632c9b67 100644
@@ -2098,6 +2098,7 @@ long enter_stack[4096];
 
 static void test_enter(void)
 {
+#if !(defined __clang__)
 #if defined(__x86_64__)
     TEST_ENTER("q", uint64_t, 0);
     TEST_ENTER("q", uint64_t, 1);
@@ -2114,6 +2115,7 @@ static void test_enter(void)
     TEST_ENTER("w", uint16_t, 1);
     TEST_ENTER("w", uint16_t, 2);
     TEST_ENTER("w", uint16_t, 31);
+#endif
 }
 
 #ifdef TEST_SSE
#5 lore raw

Re: [Qemu-devel] [PATCH v2 3/3] tests/tcg: disable enterN insn tests for test-i386 with clang

Quoted 9 lines · Paolo Bonzini
Quoted 5 lines · Alex Bennée

The enter[qwl] instructions aren't supported by clang's inline assembler. Apply the hammer to work around it when we re-use our system compiler to build tcg tests.

Do you have a bug for this in llvm? It doesn't seem to be a good idea.

I thought I had an llvm bugzilla login but I can't find the details. I'll have to a wait until an admin can add me.

Quoted 26 lines

Paolo

Quoted 23 lines
---
 tests/tcg/i386/test-i386.c | 2 ++
 1 file changed, 2 insertions(+)
tests/tcg/i386/test-i386.c +2 -0
index c5f67000e4..da632c9b67 100644
@@ -2098,6 +2098,7 @@ long enter_stack[4096];
 
 static void test_enter(void)
 {
+#if !(defined __clang__)
 #if defined(__x86_64__)
     TEST_ENTER("q", uint64_t, 0);
     TEST_ENTER("q", uint64_t, 1);
@@ -2114,6 +2115,7 @@ static void test_enter(void)
     TEST_ENTER("w", uint16_t, 1);
     TEST_ENTER("w", uint16_t, 2);
     TEST_ENTER("w", uint16_t, 31);
+#endif
 }
 
Quoted 2 lines

tests/tcg/i386/test-i386.c static void test_enter(void) · line 2121

Quoted 2 lines
tests/tcg/i386/test-i386.c +0 -0
 #ifdef TEST_SSE

--
Alex Bennée