[PATCH] Fix PR58115
Thu Jan 9 09:02:00 GMT 2014
Bernd Edlinger <firstname.lastname@example.org> writes:
> I found another test case that still fails with today's trunk:
> #include <immintrin.h>
> __m256 a, b, c;
> void __attribute__((target ("sse2"), optimize (3)))
> foo (void)
> void __attribute__((target ("avx"), optimize (3)))
> bar (void)
> a = _mm256_and_ps (b, c);
> compile with i686-pc-linux-gnu-gcc -O2 -msse2 -mno-avx -S
> The attached patch seems to fix this test case for
> targets that do not have SWITCHABLE_TARGET.
> What do you think about it?
It looks like a correct fix, but the memcpy is going to be pretty
expensive, since in most cases there will be no difference.
Calling target_reinit is the rare case, and already very slow itself,
so maybe an easier option would be to have a target_reinit counter.
I.e. for !SWITCHABLE_TARGETs only, replace TREE_OPTIMIZATION_BASE_OPTABS
with a "number of target_reinit calls" field.
Not sure it's worth the effort though. The other targets should
really move to SWITCHABLE_TARGET too. One of the reasons why I made
SWITCHABLE_TARGET optional was that I was worried it might slow down
the compiler for targets that didn't need it. Jakub's measurements
suggest that any compile-time effect is in the noise though.
> I think Jakub's patch will fix this case, but I did not try.
> However even if the i368 is now clean, there are
> still many targets that use target_reinit() in
FWIW I only see three others (nios, rs6000 and rx). nios and rs6000
are direct cut-&-pastes of the i386 version so should be easy to switch.
rx looks more like MIPS in that it's switching between two specific
More information about the Gcc-patches