[PATCH] D55192: [PowerPC] VSX register support for inline assembly

Jinsong Ji via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 6 07:06:34 PST 2018


jsji accepted this revision.
jsji added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks for fixing.



================
Comment at: clang/lib/Basic/Targets/PPC.cpp:416
+const TargetInfo::AddlRegName GCCAddlRegNames[] = {
+    {{"vs0"}, 0},   {{"vs1"}, 1},   {{"vs2"}, 2},   {{"vs3"}, 3}, 
+    {{"vs4"}, 4},   {{"vs5"}, 5},   {{"vs6"}, 6},   {{"vs7"}, 7},
----------------
nemanjai wrote:
> ZhangKang wrote:
> > ZhangKang wrote:
> > > ZhangKang wrote:
> > > > jsji wrote:
> > > > > RegNum is wrong here!
> > > > > "vs0" should be mapped to RegNum of "f0", which is 33. 
> > > > > "vs32" should be mapped to RegNum of "v0", which is 78.
> > > > I will learn it and check it, thanks for your point out my error.
> > > Here, the value of `AddlRegName` is responding to the gcc macro `ADDITIONAL_REGISTER_NAMES`. In the array `ADDITIONAL_REGISTER_NAMES`, `vs0~vs31` should be mapped to RegNum of `f0~f31`, which is `32~63`. And `vs32~vs63` should be mapped to RegNum of `v0~v31`, which is `77~108`.
> > Below is the  `ADDITIONAL_REGISTER_NAMES` GCC manual said:
> > ```
> > Macro: ADDITIONAL_REGISTER_NAMES
> > 
> >     If defined, a C initializer for an array of structures containing a name and a register number. This macro defines additional names for hard registers, thus allowing the asm option in declarations to refer to registers using alternate names. 
> > ```
> Is it possible to just not use magic numbers here at all? Do these correspond to something that is available in .td files? Is any of this possibly subject to change? Or if it is defined in some predefined macro/system header, etc. can we use the values from there?
Yes, should be 32-63, 77-108. I forgot to use 0 as index start.


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

https://reviews.llvm.org/D55192





More information about the llvm-commits mailing list