Last Comment Bug 732952 - IonMonkey: Implement LNot on ARM
: IonMonkey: Implement LNot on ARM
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: ARM Linux
: -- normal (vote)
: ---
Assigned To: general
:
: Jason Orendorff [:jorendorff]
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-05 06:42 PST by Marty Rosenberg [:mjrosenb]
Modified: 2012-03-16 16:18 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
/home/mrosenberg/patches/ImplementNotI-r0.patch (4.14 KB, patch)
2012-03-05 06:42 PST, Marty Rosenberg [:mjrosenb]
Jacob.Bramley: review+
Details | Diff | Splinter Review

Description Marty Rosenberg [:mjrosenb] 2012-03-05 06:42:04 PST
Created attachment 602883 [details] [diff] [review]
/home/mrosenberg/patches/ImplementNotI-r0.patch

implementation of NotI and NotD.
Comment 1 Jacob Bramley [:jbramley] 2012-03-05 07:48:34 PST
Comment on attachment 602883 [details] [diff] [review]
/home/mrosenberg/patches/ImplementNotI-r0.patch

Review of attachment 602883 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/ion/arm/CodeGenerator-arm.cpp
@@ +1138,5 @@
>  
> +bool
> +CodeGeneratorARM::visitNotI(LNotI *ins)
> +{
> +    // It is hard to optimize !x, so just do it the basic way for now.

Hmm. Tricky. The best I can come up with is to subtract it from 1, then use movlo or movls to write 0:

rsbs rOUT, rIN, #1 // rOUT = 1 - rIN. If (and only if) it started as 0, it becomes 1 ...
movls rOUT, #0     // ... otherwise it becomes 0.

movlo has the same effect here, since in the only case where the condition differs, rOUT is 0 anyway.

Having said that, the current implementation is perfectly adequate, but it's fun to think about these things!

@@ +1157,5 @@
> +
> +    // Do the compare
> +    masm.ma_vcmpz(opd);
> +    bool nocond = true;
> +    if (nocond) {

This nocond stuff looks like debugging code.

@@ +1162,5 @@
> +        // Load the value into the dest register
> +        masm.as_vmrs(dest);
> +        masm.ma_lsr(Imm32(28), dest, dest);
> +        masm.ma_alu(dest, lsr(dest, 2), dest, op_orr); // 28 + 2 = 30
> +        masm.ma_and(Imm32(1), dest);

Nice. This is probably the quickest way to do it.
Comment 2 Marty Rosenberg [:mjrosenb] 2012-03-16 16:18:58 PDT
landed: http://hg.mozilla.org/projects/ionmonkey/rev/d72074514c6f

Note You need to log in before you can comment on or make changes to this bug.