pengfei added a comment.

In D131134#3715079 <https://reviews.llvm.org/D131134#3715079>, @craig.topper 
wrote:

> In D131134#3715062 <https://reviews.llvm.org/D131134#3715062>, @pengfei wrote:
>
>> In D131134#3715024 <https://reviews.llvm.org/D131134#3715024>, @pengfei 
>> wrote:
>>
>>> In D131134#3714860 <https://reviews.llvm.org/D131134#3714860>, 
>>> @craig.topper wrote:
>>>
>>>> Yes AMX is only supported in 64-bit mode but I doubt CPUID checks which 
>>>> mode the program is running in.
>>>
>>> I guess `HasAMXSave` is `false` on 32-bit mode 
>>> https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/Host.cpp#L1800.
>>>  But I don't have the environment to check it.
>>
>> I found it. The `XFEATURE_MASK_XTILE` in Kernel is the same as `HasAMXSave` 
>> in compiler: 
>> https://lwn.net/ml/linux-kernel/20210710130313.5072-20-chang.seok....@intel.com/
>> So these features bits are `true` only on 64-bit mode.
>
> Is it cleared when running a 32-bit binary on a 64-bit kernel?

No, a 32-bit binary gets the same CR0 as 64-bit on a 64-bit kernel. Actually, 
it's compiler to get the CR0 rather than the binary it builds. It should be 
rare to run 32-bit compiler on 64-bit kernel.
So you are right. No matter 32 or 64 bits compiler, when it builds a binary 
with `-m32` on 64-bit kernel with `-march=native`, it always sets AMX features. 
Maybe we should reset them to false when compile for 32-bit?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131134/new/

https://reviews.llvm.org/D131134

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to