Is it possible to enhance the vector STG registers(Xmm, Ymm, Zmm) with more information?

Carter Schonwald carter.schonwald at
Wed Jun 27 23:29:26 UTC 2018

hrmm, i think i can help with this tomorrow/ rest of the week, (esp since
i'm one of your mentors :) )

but if other folks have design ideas, more than happy to use as many ideas
as possible!

On Wed, Jun 27, 2018 at 5:32 PM Abhiroop Sarkar <asiamgenius at>

> Hello all,
> I am currently working on adding support for SIMD operations to the native
> code generator. One of the roadblocks I faced recently was the definition
> of the `globalRegType` function in "compiler/cmm/CmmExpr.hs". The
> `globalRegType` function maps the STG registers to the respective `CmmType`
> datatype.
> For Xmm, Ymm, Zmm registers the function defines globalRegType like this:
> Consider the case for an Xmm register, the above definition limits an Xmm
> register to hold only vectors of size 4. However we can store 2 64-bit
> Doubles or 16 Int8s or 8 Int16s and so on
> The function `globalRegType` is internally called by the function
> `cmmRegType` (
> which is itself used in a number of places in the x86 code generator.
> In fact depending on the result of the `cmmRegType` function is another
> important function `cmmTypeFormat` defined in Format.hs whose result is
> used to print the actual assembly instruction.
> I have extended all the other Format types to include VectorFormats,
> however this definition of the `globalRegType` seems incorrect to me.
> Looking at the signature of the function itself:
> `globalRegType :: DynFlags -> GlobalReg -> CmmType`
> its actually difficult to predict the CmmType by just looking at the
> GlobalReg in case of Xmm, Ymm, Zmm. So thats why my original question how
> do I go about solving this. Should I modify the GlobalReg type to contain
> more information like Width and Length(for Xmm, Ymm, Zmm)  or do I somehow
> pass the length and width information to the globalRegType function?
> Thanks
> Abhiroop Sakar
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list