> Chandler’s complex arithmetic changes are also in the range: r219557 in clang. We saw it change the code in mandel-2 significantly.mandel-2 is broken on hard FP ABI systems, btw. The reason is simply: we're emitting a call to __muldc3 with AAPCS VFP calling convention, however, the function expects softfp (AAPCS) calling conv and reads garbage from GP registers. I'm working on fix. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
I submitted r219517 (not in the suspect range) which improved SCEV by enabling computation of trip counts if the loop has multiple exits. One of the things this enables is loop unrolling for loops with multiple exits. Then Chandler submitted r219550 and r219562 (in the suspect range) to fix some latent bugs that my change exposed (thanks, btw). The regressing benchmark ( http://llvm.org/klaus/test-suite/blob/release_32/SingleSource/Benchmarks/Misc/mandel-2.c) *does* have a loop with multiple exits (the core loop of the benchmark). However, it's not unrolled with -O3 because the trip count of the loop latch is not computable at compile time. Nor is it vectorizable (the vectorizor uses trip count computation). So, I'd speculate the reason for the regression lies elsewhere (complex arithmetic?). Mark On Fri, Oct 17, 2014 at 7:51 AM, Anton Korobeynikov <anton at korobeynikov.info> wrote:> > Chandler's complex arithmetic changes are also in the range: r219557 in > clang. We saw it change the code in mandel-2 significantly. > mandel-2 is broken on hard FP ABI systems, btw. The reason is simply: > we're emitting a call to __muldc3 with AAPCS VFP calling convention, > however, the function expects softfp (AAPCS) calling conv and reads > garbage from GP registers. > > I'm working on fix. > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141017/bf0b7e17/attachment.html>
On Fri, Oct 17, 2014 at 7:51 AM, Anton Korobeynikov <anton at korobeynikov.info> wrote:> > Chandler’s complex arithmetic changes are also in the range: r219557 in > clang. We saw it change the code in mandel-2 significantly. > mandel-2 is broken on hard FP ABI systems, btw. The reason is simply: > we're emitting a call to __muldc3 with AAPCS VFP calling convention, > however, the function expects softfp (AAPCS) calling conv and reads > garbage from GP registers. > > I'm working on fix.Thanks for looking at this Anton. I don't really know what signal should be used here. Several initial attempts at this didn't work because of ABI and calling convention issues and I thought I had figured out a sound solution by directly forming and calling the library routines using Clang's code generation to handle all of the ABI issues.... but apparently not. If you need to back out the patch temporarily or take any other steps to mitigate, by all means. =/ Sorry for the fallout. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141018/a99ee543/attachment.html>
Hi Chandler, That's embarrassing how weird this part of clang is. I have a provisional patch which fixes the problem but underlines clang's problems. I will submit it tonight for comments. суббота, 18 октября 2014 г. пользователь Chandler Carruth написал:> > On Fri, Oct 17, 2014 at 7:51 AM, Anton Korobeynikov < > anton at korobeynikov.info > <javascript:_e(%7B%7D,'cvml','anton at korobeynikov.info');>> wrote: > >> > Chandler’s complex arithmetic changes are also in the range: r219557 >> in clang. We saw it change the code in mandel-2 significantly. >> mandel-2 is broken on hard FP ABI systems, btw. The reason is simply: >> we're emitting a call to __muldc3 with AAPCS VFP calling convention, >> however, the function expects softfp (AAPCS) calling conv and reads >> garbage from GP registers. >> >> I'm working on fix. > > > Thanks for looking at this Anton. > > I don't really know what signal should be used here. Several initial > attempts at this didn't work because of ABI and calling convention issues > and I thought I had figured out a sound solution by directly forming and > calling the library routines using Clang's code generation to handle all of > the ABI issues.... but apparently not. > > If you need to back out the patch temporarily or take any other steps to > mitigate, by all means. =/ Sorry for the fallout. >-- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141018/958de1a8/attachment.html>
On Fri, Oct 17, 2014 at 06:51:38PM +0400, Anton Korobeynikov wrote:> > Chandler’s complex arithmetic changes are also in the range: r219557 in clang. We saw it change the code in mandel-2 significantly. > mandel-2 is broken on hard FP ABI systems, btw. The reason is simply: > we're emitting a call to __muldc3 with AAPCS VFP calling convention, > however, the function expects softfp (AAPCS) calling conv and reads > garbage from GP registers.One possible approach is the attached patch. It is not completely correct as it doesn't handle the possible exceptions for WoA and iOS, but it might be a starting point. The real question for me is whether this logic belongs into clang at all. Who can speak up for the Fortran related behavior of complex arithmetic? If it matters the desired C rules, especially with regard to real and imaginary numbers, it would strongly support putting it into IR properly. Joerg -------------- next part -------------- A non-text attachment was scrubbed... Name: CGExprComplex.cpp.diff Type: text/x-diff Size: 968 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141019/9d1ccda4/attachment.diff>
On Sun, Oct 19, 2014 at 6:11 AM, Joerg Sonnenberger <joerg at britannica.bec.de> wrote:> On Fri, Oct 17, 2014 at 06:51:38PM +0400, Anton Korobeynikov wrote: > > > Chandler’s complex arithmetic changes are also in the range: r219557 > in clang. We saw it change the code in mandel-2 significantly. > > mandel-2 is broken on hard FP ABI systems, btw. The reason is simply: > > we're emitting a call to __muldc3 with AAPCS VFP calling convention, > > however, the function expects softfp (AAPCS) calling conv and reads > > garbage from GP registers. > > One possible approach is the attached patch. It is not completely > correct as it doesn't handle the possible exceptions for WoA and iOS, > but it might be a starting point. The real question for me is whether > this logic belongs into clang at all. Who can speak up for the Fortran > related behavior of complex arithmetic? If it matters the desired C > rules, especially with regard to real and imaginary numbers, it would > strongly support putting it into IR properly. >I apologize that I haven't been able to follow this thread entirely, but if someone gives me a Fortran testcase I can check what Fortran+llvm would do currently and maybe give more feedback. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141019/7e3f320f/attachment.html>