Travis tweaks and tcg test fixes
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
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
@@ -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
PATCH v2 2/3 tests/tcg: make test-i386 test program compile on clang
In reply to Alex BennéeFrom: 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
--- tests/tcg/i386/test-i386.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
tests/tcg/i386/test-i386.c +16 -4
@@ -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 ); asmvolatile ("fldcw %0" : :"m" (val16)); - asmvolatile ("fist %0" :"=m" (wa) :"t" (a)); + asmvolatile ("fists %0" :"=m" (wa) :"t" (a)); asmvolatile ("fistl %0" :"=m" (ia) :"t" (a)); asmvolatile ("fistpll %0" :"=m" (lla) :"t" (a) :"st" ); asmvolatile ("frndint ; fstl %0" :"=m" (ra) :"t" (a));
@@ -1317,12 +1325,12 @@ void test_segs(void) seg_data1[1 ] =0xaa ; seg_data2[1 ] =0x55 ; - asmvolatile ("fs movzbl 0x1, %0" :"=r" (res)); + asmvolatile ("movzbl %%fs:0x1, %0" :"=r" (res));printf ("FS[1] = %02x\n" , res); asmvolatile ("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__) + asmvolatile ("bound %1, %0" : :"r" (11 ),"m" (tab[0 ])); +#else asmvolatile ("bound %0, %1" : :"r" (11 ),"m" (tab[0 ])); +#endif }#endif
Signature · 1 line
2.17.1
PATCH v2 3/3 tests/tcg: disable enterN insn tests for test-i386 with clang
In reply to Alex BennéeThe 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
@@ -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
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.
Signed-off-by Alex Bennée <[email protected]>
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@@ -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
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.
Signed-off-by Alex Bennée <[email protected]>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@@ -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