search for: sext

Displaying 20 results from an estimated 656 matches for "sext".

Did you mean: set
2017 Jun 02
5
RFC: Killing undef and spreading poison
...onvinced that you >> lose optimization power except in code that actually exhibits undefined >> behavior. > > I'm not sure I understood your concern fully, but you could have cases like: > > for (...) { > if (condition){ > i32 prod = x *nsw y > i64 prod.sext = sext prod to i64 > i64 t = K `udiv` (-1 + (sum.prod >> 32)) > use(t) > } > } I'm sure it is obvious to you, but there's a typo here -- it should have been "i64 t = K `udiv` (-1 + (prod.sext >> 32))" > The C program this came from is well defined...
2016 Nov 11
2
RFC: Killing undef and spreading poison
Hi John, John McCall wrote: >> On Nov 10, 2016, at 10:37 PM, Sanjoy Das<sanjoy at playingwithpointers.com> wrote: >> As a concrete example, say we have: >> >> i32 sum = x *nsw y >> i64 sum.sext = sext sum to i64 >> ... >> some use of sum.sext >> >> >> Pretending "x +nsw 1" does not sign-overflow, we can commute the sext >> into the arithmetic, but we still somehow need to capture the fact >> that, depending on the optimizer's whims a...
2008 Oct 06
3
[LLVMdev] sext..to instruction
Hi, I have a question about the "sext..to" instruction. In the document, I found two examples: %x = sext i8 -1 to i16 It means: i8 -1 = 1111 1111 --> 1111 1111 1111 1111 = i16 how can it determinate, that the i16 value %x positive is (65535)? And the second example: %y = sext i1 true to i32 1 --> 1111 1111 1111 1111 1111...
2013 Jun 20
2
[LLVMdev] Error in the example of sext instruction in reference manual
Hi all, There might be a simple error in the LLVM reference manual. The example for sext instruction: %X = sext i8 -1 to i16 ; yields i16 :65535 %X should yield i16: -1, as opposed to 65535. Here is the simple patch (also attached): Index: docs/LangRef.rst =================================================================== --- docs/LangRef.rst (revision 184496) +++ docs/La...
2017 Jun 07
2
RFC: Killing undef and spreading poison
...Lawrence. On Jun 5, 2017, at 12:02 PM, Sanjoy Das <sanjoy at playingwithpointers.com> wrote: Hi Peter, On Mon, Jun 5, 2017 at 9:43 AM, Peter Lawrence <peterl95124 at sbcglobal.net> wrote: I think it is valid by definition -- since "A *nsw B" does not sign wrap, "sext(A *nsw B)" == (sext A) * (sext B). In other words, these two expressions are inequal only if "A *nsw B" sign wraps. The way you use “nsw” it seems like an assertion or an assumption. Yes, that is correct. Where did the “nsw” come from, is it from the source language definition, O...
2015 Apr 01
2
[LLVMdev] Cast to SCEVAddRecExpr
...annot > sign-overflow. I'd venture a guess that this lets LLVM transform a > sign-extend of an add-rec to an add-rec sign-extends. I agree here, we want LLVM to transform sign-extend of add-rec to add-rec of sign extend in possible cases. Currently I don’t see LLVM is doing this. i.e.: (sext i32 addrec{2,+,2}<%for.body4> to i64) Will convert it to: addrec{(sext i32 '2' to i64), + , (sext i32 '2' to i64)} <%for.body4> If this looks OK, I'll make changes and come up with a patch. With sign-extend (SCEVSignExtendExpr) similarly we have to take care and h...
2013 Jun 21
0
[LLVMdev] Error in the example of sext instruction in reference manual
On Jun 20, 2013, at 4:39 PM, Bin Tzeng <bintzeng at gmail.com> wrote: > Hi all, > > There might be a simple error in the LLVM reference manual. The example for sext instruction: > > %X = sext i8 -1 to i16 ; yields i16 :65535 > > %X should yield i16: -1, as opposed to 65535. > Here is the simple patch (also attached): These are the same value. -Chris > > Index: docs/LangRef.rst > =============================================...
2019 Sep 27
2
Shift-by-signext - sext is bad for analysis - ignore it's use count?
In https://reviews.llvm.org/D68103 the InstCombine learned that shift-by-sext is simply a shift-by-zext. But the transform is limited to single-use sext. We can quite trivially get a case where there are two shifts by the same sext: https://godbolt.org/z/j6mO3t <- We should handle those cases. In https://reviews.llvm.org/D68103#1686130 Sanjay Patel notes that this sext...
2019 Oct 01
2
Shift-by-signext - sext is bad for analysis - ignore it's use count?
Thanks for taking a look! On Tue, Oct 1, 2019 at 9:09 PM Philip Reames <listmail at philipreames.com> wrote: > On 9/27/19 1:40 PM, Roman Lebedev via llvm-dev wrote: > > In https://reviews.llvm.org/D68103 the InstCombine learned that shift-by-sext > > is simply a shift-by-zext. > > Just to make sure I'm following, the reasoning here is that the shift > amount must be positive or the shift would produce poison? And thus, > it's safe to assume that the sext == zext because we've (at worst) > removed UB in the o...
2016 Oct 20
2
RFC: Killing undef and spreading poison
...n Wed, Oct 19, 2016 at 6:27 PM, Alexandre Isoard <alexandre.isoard at gmail.com> wrote: > Really interesting read. I am perplexed now, and am not even sure what is > the meaning of undef anymore. Welcome aboard. :) > Example (unrelated to your blog post, but still weird): > %x = sext i1 undef to i2 > > I understand that I can replace it by either of: > %x = i2 0 > %x = i2 -1 > > But can I replace it by: > %x = i2 undef > > I would have said no, at first sight, because -2 and 1 should not be > possible values. > But if I look at each bit, indepen...
2012 Jun 16
2
[LLVMdev] SCEV not simplifying
I have a pair of SCEVs that appear different to me. However, when I compute the difference, it's not known to be non-zero. src = (sext i32 %n to i64) dst = (sext i32 (1 + %n) to i64) delta = ((sext i32 %n to i64) + (-1 * (sext i32 (1 + %n) to i64))) Is this behavior expected? If I repeat the experiment with 64-bit ints (or unsigned), things work out like I expect. 32-bit unsigned is also bad. Thanks, Preston -----------...
2015 Apr 29
2
[LLVMdev] [LoopVectorizer] Missed vectorization opportunities caused by sext/zext operations
...o the previous thread regarding missed vectorization opportunities (http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-April/084765.html), but maybe different enough to require a new thread. I'm seeing some missed vectorization opportunities in the loop vectorizer because SCEV is not able to fold sext/zext expressions into recurrence expressions (AddRecExpr). This can manifest in multiple ways: - We cannot get the back-edges taken count since SCEV because we may have something like (sext (1,+1)) which we can't evaluate as it can overflow - We cannot get SCEV AddRec exp...
2016 Apr 23
2
[IndVarSimplify] Narrow IV's are not eliminated resulting in inefficient code
Hi Sanjoy, Thank you for looking into this! Yes, your patch does fix my larger test case too. My algorithm gets double performance improvement with the patch, as the loop now has a smaller instruction set and succeeds to unroll w/o any extra #pragma's. I also ran the LLVM tests against the patch. There are 6 new failures: Analysis/LoopAccessAnalysis/number-of-memchecks.ll
2015 Mar 19
2
[LLVMdev] Cast to SCEVAddRecExpr
Hi Nick, Thanks for looking into it. I have tried that as well but it didn't worked. "AddExpr->getOperand(0))" node is: " (4 * (sext i32 {2,+,2}<%for.body4> to i64))<nsw>" When I cast this to "SCEVAddRecExpr" it returns NULL. Regards, Ashutosh -----Original Message----- From: Nick Lewycky [mailto:nicholas at mxc.ca] Sent: Thursday, March 19, 2015 12:19 PM To: Nema, Ashutosh Cc: llvmdev at cs.uiuc.e...
2008 Oct 06
0
[LLVMdev] sext..to instruction
> I'm not sure about it, when sext to results a positve/negative value? sext does signed-extension, zext does unsigned-extension. This means that zext always extends by zero bits, while with sext the additional bits are all copies of the top bit of the original value. So with sext, if it was negative in the original type when cons...
2015 Mar 19
3
[LLVMdev] Cast to SCEVAddRecExpr
Yes, I can get "SCEVAddRecExpr" from operands of "(sext i32 {2,+,2}<%for.body4> to i64)". So whenever SCEV cast to "SCEVAddRecExpr" fails, we have drill down for such patterns ? Is that the right way ? Regards, Ashutosh -----Original Message----- From: Nick Lewycky [mailto:nicholas at mxc.ca] Sent: Thursday, March 19, 2015 1:0...
2013 Oct 28
2
[LLVMdev] loop vectorizer says Bad stride
...ying function running passes ... LV: Checking a loop in "bar" LV: Found a loop: L0 LV: Found an induction variable. LV: We need to do 0 pointer comparisons. LV: Checking memory dependencies LV: Bad stride - Not an AddRecExpr pointer %13 = getelementptr float* %arg2, i32 %1 SCEV: ((4 * (sext i32 {(256 + %arg0),+,1}<nw><%L0> to i64)) + %arg2) LV: Src Scev: {((4 * (sext i32 %arg0 to i64)) + %arg2),+,4}<%L0>Sink Scev: ((4 * (sext i32 {(256 + %arg0),+,1}<nw><%L0> to i64)) + %arg2)(Induction step: 1) LV: Distance for store float %11, float* %12 to store...
2019 Oct 01
2
Shift-by-signext - sext is bad for analysis - ignore it's use count?
...t;> Thanks for taking a look! >> >> On Tue, Oct 1, 2019 at 9:09 PM Philip Reames <listmail at philipreames.com> wrote: >> > On 9/27/19 1:40 PM, Roman Lebedev via llvm-dev wrote: >> > > In https://reviews.llvm.org/D68103 the InstCombine learned that shift-by-sext >> > > is simply a shift-by-zext. >> > >> > Just to make sure I'm following, the reasoning here is that the shift >> > amount must be positive or the shift would produce poison? And thus, >> > it's safe to assume that the sext == zext because...
2019 Oct 07
2
Shift-by-signext - sext is bad for analysis - ignore it's use count?
...t; >> > > >> On Tue, Oct 1, 2019 at 9:09 PM Philip Reames <listmail at philipreames.com> wrote: > > >> > On 9/27/19 1:40 PM, Roman Lebedev via llvm-dev wrote: > > >> > > In https://reviews.llvm.org/D68103 the InstCombine learned that shift-by-sext > > >> > > is simply a shift-by-zext. > > >> > > > >> > Just to make sure I'm following, the reasoning here is that the shift > > >> > amount must be positive or the shift would produce poison? And thus, > > >> > it...
2013 Jun 21
2
[LLVMdev] Error in the example of sext instruction in reference manual
...? On Thu, Jun 20, 2013 at 9:17 PM, Chris Lattner <clattner at apple.com> wrote: > > On Jun 20, 2013, at 4:39 PM, Bin Tzeng <bintzeng at gmail.com> wrote: > > > Hi all, > > > > There might be a simple error in the LLVM reference manual. The example > for sext instruction: > > > > %X = sext i8 -1 to i16 ; yields i16 :65535 > > > > %X should yield i16: -1, as opposed to 65535. > > Here is the simple patch (also attached): > > These are the same value. > > -Chris > > > > > Index: docs/LangRef....