From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3554 invoked by alias); 4 Dec 2013 00:41:34 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 3523 invoked by uid 48); 4 Dec 2013 00:41:30 -0000 From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/59379] gomp_init_num_threads is compiled into an infinite loop with --with-arch=corei7 --with-cpu=slm Date: Wed, 04 Dec 2013 00:41:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hjl.tools at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-12/txt/msg00243.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59379 --- Comment #4 from H.J. Lu --- Created attachment 31372 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31372&action=edit A testcase The outputs from stage 2 and stage 3 cc1 are different: [hjl@gnu-mic-2 pr59379]$ make /export/build/gnu/gcc-lto-fdo/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc-lto-fdo/build-x86_64-linux/gcc/ -ftls-model=initial-exec -fPIC -O2 -S test.c /export/build/gnu/gcc-lto-fdo/build-x86_64-linux/prev-gcc/xgcc -B/export/build/gnu/gcc-lto-fdo/build-x86_64-linux/prev-gcc/ -ftls-model=initial-exec -fPIC -O2 -S -o good.s test.c diff -up test.s good.s --- test.s 2013-12-03 16:38:50.413067359 -0800 +++ good.s 2013-12-03 16:38:50.473066316 -0800 @@ -27,7 +27,7 @@ gomp_init_num_threads: movq %rdi, gomp_cpuset_size(%rip) call gomp_malloc@PLT .p2align 4,,15 -.L24: +.L27: movq %rax, gomp_cpusetp(%rip) movq %rax, %rbx .L2: @@ -40,9 +40,9 @@ gomp_init_num_threads: xorl %eax, %eax call pthread_getaffinity_np@PLT testl %eax, %eax - je .L27 + je .L30 cmpl $22, %eax - jne .L25 + jne .L28 movq gomp_cpuset_size(%rip), %rsi cmpq $127, %rsi ja .L10 @@ -64,8 +64,8 @@ gomp_init_num_threads: movq gomp_cpusetp(%rip), %rdi call realloc@PLT testq %rax, %rax - jne .L24 -.L25: + jne .L27 +.L28: movq gomp_global_icv@GOTPCREL(%rip), %rbx .L4: movq gomp_cpusetp(%rip), %rdi @@ -88,7 +88,7 @@ gomp_init_num_threads: ret .p2align 4,,7 .p2align 3 -.L27: +.L30: .cfi_restore_state movq gomp_cpusetp(%rip), %rsi movq gomp_cpuset_size(%rip), %rdi @@ -98,35 +98,31 @@ gomp_init_num_threads: testq %rax, %rax movq %rax, (%rbx) je .L4 - movq gomp_cpuset_size(%rip), %rdi - movq %rdi, gomp_get_cpuset_size(%rip) - salq $3, %rdi + movq gomp_cpuset_size(%rip), %rsi + movq %rsi, gomp_get_cpuset_size(%rip) + salq $3, %rsi je .L14 - movq %rdi, %r8 - movq %rdi, %rsi - movq gomp_cpusetp(%rip), %r9 - negq %r8 - salq $32, %r8 - jmp .L6 + movq gomp_cpusetp(%rip), %rdi + movq %rsi, %rdx + jmp .L8 .p2align 4,,7 .p2align 3 -.L8: - testq %rdx, %rdx - je .L5 .L7: - movq %rcx, %rsi + testq %rcx, %rcx + je .L5 .L6: - leaq -1(%rsi), %rcx - leaq (%rcx,%r8), %rdx - cmpq %rdx, %rdi - jbe .L7 + movq %rcx, %rdx +.L8: + leaq -1(%rdx), %rcx + cmpq %rcx, %rsi + jbe .L6 movq %rcx, %rax shrq $6, %rax - movq (%r9,%rax,8), %rax + movq (%rdi,%rax,8), %rax shrq %cl, %rax andl $1, %eax - je .L8 - leaq 63(%rsi), %rax + je .L7 + leaq 63(%rdx), %rax shrq $6, %rax salq $3, %rax .L5: make: *** [all] Error 1