[llvm-dev] shl

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] shl

Shawn Webb via llvm-dev
Hi,
I got a question about the SDNode "shl"

def shl        : SDNode<"ISD::SHL"       , SDTIntShiftOp>;

Does it stand for "shift logical" and in what direction does it shift?
How to shift in the other direction?

Thanks.

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] shl

Shawn Webb via llvm-dev
That stands for "shift left". Shift right is sra for arithmetic shift right and srl for logical shift right. Not sure why we don't use ashr and lshr like IR. Instead we seem to be using the X86 mnemonic names.

~Craig


On Wed, May 15, 2019 at 1:03 PM Josh Sharp via llvm-dev <[hidden email]> wrote:
Hi,
I got a question about the SDNode "shl"

def shl        : SDNode<"ISD::SHL"       , SDTIntShiftOp>;

Does it stand for "shift logical" and in what direction does it shift?
How to shift in the other direction?

Thanks.
_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] shl

Shawn Webb via llvm-dev
In reply to this post by Shawn Webb via llvm-dev
On Wed, May 15, 2019 at 11:03 PM Josh Sharp via llvm-dev
<[hidden email]> wrote:
>
> Hi,
> I got a question about the SDNode "shl"
>
> def shl        : SDNode<"ISD::SHL"       , SDTIntShiftOp>;
>
> Does it stand for "shift logical" and in what direction does it shift?
shift left

> How to shift in the other direction?
ISD::SRA (arithmetic), ISD::SRL (logical)
See https://llvm.org/doxygen/ISDOpcodes_8h_source.html#l00429

> Thanks.
Roman.

> _______________________________________________
> LLVM Developers mailing list
> [hidden email]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

On Wed, May 15, 2019 at 11:03 PM Josh Sharp via llvm-dev
<[hidden email]> wrote:

>
> Hi,
> I got a question about the SDNode "shl"
>
> def shl        : SDNode<"ISD::SHL"       , SDTIntShiftOp>;
>
> Does it stand for "shift logical" and in what direction does it shift?
> How to shift in the other direction?
>
> Thanks.
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] shl

Shawn Webb via llvm-dev
In reply to this post by Shawn Webb via llvm-dev
On 5/15/2019 1:03 PM, Josh Sharp via llvm-dev wrote:
> Hi,
> I got a question about the SDNode "shl"
>
> def shl        : SDNode<"ISD::SHL"       , SDTIntShiftOp>;
>
> Does it stand for "shift logical" and in what direction does it shift?
> How to shift in the other direction?

SHift Left.

The corresponding right shifts are SRA (Shift Right Arithmetic) and SRL
(Shift Right Logical). The former shifts in copies of the sign bit at
the top, the latter shifts in zeroes.

-Fabian
_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev