Closed Bug 732952 Opened 12 years ago Closed 12 years ago

IonMonkey: Implement LNot on ARM

Categories

(Core :: JavaScript Engine, defect)

ARM
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mjrosenb, Unassigned)

Details

Attachments

(1 file)

implementation of NotI and NotD.
Attachment #602883 - Flags: review?(Jacob.Bramley)
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.
Attachment #602883 - Flags: review?(Jacob.Bramley) → review+
landed: http://hg.mozilla.org/projects/ionmonkey/rev/d72074514c6f
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.