IonMonkey: Implement LNot on ARM

RESOLVED FIXED

Status

()

Core
JavaScript Engine
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: mjrosenb, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
Created attachment 602883 [details] [diff] [review]
/home/mrosenberg/patches/ImplementNotI-r0.patch

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+
(Reporter)

Comment 2

5 years ago
landed: http://hg.mozilla.org/projects/ionmonkey/rev/d72074514c6f
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.