<div dir="ltr">Hi all,<div><br></div><div>I have a sample test case :</div><div><br></div><div>$ cat 1.c</div><div><br></div><div><div>int foo(int x, int y){</div><div>  int z = x + y;</div><div>  return z/2;</div><div>}</div></div><div><br></div><div>I tried to get its IR form with clang providing subtarget feature as mmx for target x86_64</div><div><br></div><div>$ clang -O3 -mmmx 1.c -S -emit-llvm</div><div><br></div><div>in the IR generated i can see the subtarget-features as function attribute :</div><div><br></div><div>"target-features"="+mmx"</div><div><br></div><div>In the SelectionDAG phase in file "X86ISelLowering.cpp", i checked in one of the function  what is the subtarget feature by calling few routines of Subtarget.</div><div><br></div><div>Subtarget->hasMMX()  ------ true</div><div>Subtarget->hasSSE1() ------ true</div><div>Subtarget->hasSSE2() ------ true</div><div><br></div><div>These functions just compare the X86SSELevel with subtarget enum values like MMX, SSE1, SSE2 etc.</div><div><br></div><div>hasMMX() { return X86SSELevel >= MMX}; // similar for others</div><div><br></div><div>Now, enum values start from  MMX and goes on increasing with SSE1, SSE2, etc.</div><div><br></div><div>For the above test case, the X86SSELevel is set to SSE2, which is confusing, since i have explicitly specified the target feature as 'mmx'. Why the X86SSELevel is getting set to SSE2 despite providing target-feature as mmx? Is it something to do with default feature of x86_64?</div><div><br></div><div>I wanted to distinguish my code generation based on subtarget feature for MMX and SSE, which i am unable to do so currently because of above scenario.</div><div><br></div><div>I am sure i am missing something fundamental, but unable to exactly find out what.</div><div><br></div><div>Can someone please help me out on above question?</div><div><br></div><div>Thanks.</div><div><br></div><div>Regards,</div><div>Suyog Sarda </div></div>