Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[x86] After 16f3d698f2af, -march=amdfam10 incorrectly implies SSSE3 instructions #46808

Closed
DimitryAndric opened this issue Sep 8, 2020 · 4 comments
Labels
backend:X86 bugzilla Issues migrated from bugzilla

Comments

@DimitryAndric
Copy link
Collaborator

Bugzilla Link 47464
Resolution FIXED
Resolved on Sep 08, 2020 12:00
Version 11.0
OS All
Blocks #46070
CC @avg-I,@topperc,@zmodem,@LebedevRI,@RKSimon,@rotateright
Fixed by commit(s) e6bb4c8

Extended Description

After https://reviews.llvm.org/D83273 /
16f3d698f2af ("[X86] Move
the feature dependency handling in X86TargetInfo::setFeatureEnabledImpl
to a table based lookup in X86TargetParser.cpp"), compiling with -march=amdfam10 incorrectly starts using SSSE3 instructions, in particular pshufb.

Test case:

#include <xmmintrin.h>

__m128i foo(unsigned char c) {
return _mm_set1_epi8(c);
}

Asm output before:

foo: # @​foo
.cfi_startproc

%bb.0: # %entry

    movd    %edi, %xmm0
    punpcklbw       %xmm0, %xmm0            # xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
    pshuflw $224, %xmm0, %xmm0              # xmm0 = xmm0[0,0,2,3,4,5,6,7]
    pshufd  $0, %xmm0, %xmm0                # xmm0 = xmm0[0,0,0,0]
    retq

After:

foo: # @​foo
.cfi_startproc

%bb.0: # %entry

    movd    %edi, %xmm0
    pxor    %xmm1, %xmm1
    pshufb  %xmm1, %xmm0
    retq

Apparently 16f3d69#diff-045a11495d5fad4e01af59c60f6a387aR500 makes SSE4_A now imply SSSE3, which is not correct (at least not always, I think).

@zmodem
Copy link
Collaborator

zmodem commented Sep 8, 2020

Craig, can you take a look?

@avg-I
Copy link

avg-I commented Sep 8, 2020

Perhaps it was just a typo -- SSE3 vs SSSE3?

@topperc
Copy link
Collaborator

topperc commented Sep 8, 2020

Fixed by e6bb4c8

@zmodem
Copy link
Collaborator

zmodem commented Sep 8, 2020

Fixed by e6bb4c8

Thanks! Pushed to 11.x as 6f1dbbc.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:X86 bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

4 participants