Skip to contentSkip to conversation

: SIMD add/sub instructions are incorrect

Qemu-devel Bradley Smith 2 participants 4 messages Jun 8, 2010 – Jul 29, 2010

lore
Share & tools
lore
#0 lore raw

Public bug reported:

The thumb2 and unsigned arm state SIMD add/sub instructions are implemented incorrectly, for example:

UQSUB8 r0, r1, r0

gives r0 as 0, where r0 is 0x12345678 and r1 is 0x23456789 in ARM state, and:

UHSUB8 r0, r1, r0

gives r0 as 0x1111be01, where r0 is 0x12345678 and r1 is 0x23456789 in thumb2 state.

This problem is present in git HEAD, (at time of writing, fd1dc858370d9a9ac7ea2512812c3a152ee6484b).

** Affects: qemu
Importance: Undecided
Status: New

Signature · 19 lines
[ARM]: SIMD add/sub instructions are incorrect
https://bugs.launchpad.net/bugs/591320
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
The thumb2 and unsigned arm state SIMD add/sub instructions are implemented incorrectly, for example:

  UQSUB8 r0, r1, r0

gives r0 as 0,  where r0 is 0x12345678 and r1 is 0x23456789 in ARM state, and:

  UHSUB8 r0, r1, r0

gives r0 as 0x1111be01, where r0 is 0x12345678 and r1 is 0x23456789 in thumb2 state.

This problem is present in git HEAD, (at time of writing, fd1dc858370d9a9ac7ea2512812c3a152ee6484b).
#1 lore raw

The first one results from wrong saturation judgment. The original form is :

uint8_t sub8_usat(uint8_t a, uint8_t b) {
    if (a < b)
        return a - b;
    else
        return 0;
}

it should be " a > b"

The second problem is using op2 as op1 to tell among signed, unsigned, and half group

** Patch added: "For case 2"
http://launchpadlibrarian.net/50000603/0001-target-arm-fix-thumb2-parallel-add-sub-opcode-decodi.patch

Signature · 19 lines
[ARM]: SIMD add/sub instructions are incorrect
https://bugs.launchpad.net/bugs/591320
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
The thumb2 and unsigned arm state SIMD add/sub instructions are implemented incorrectly, for example:

  UQSUB8 r0, r1, r0

gives r0 as 0,  where r0 is 0x12345678 and r1 is 0x23456789 in ARM state, and:

  UHSUB8 r0, r1, r0

gives r0 as 0x1111be01, where r0 is 0x12345678 and r1 is 0x23456789 in thumb2 state.

This problem is present in git HEAD, (at time of writing, fd1dc858370d9a9ac7ea2512812c3a152ee6484b).
#2 lore raw
In reply to Bradley Smith

One attachment is allowed in each comment :<

for case 1

** Patch added: "for case 1 problem"
http://launchpadlibrarian.net/50000666/0002-target-arm-fix-parallel-saturated-subtraction-error.patch

Signature · 19 lines
[ARM]: SIMD add/sub instructions are incorrect
https://bugs.launchpad.net/bugs/591320
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
The thumb2 and unsigned arm state SIMD add/sub instructions are implemented incorrectly, for example:

  UQSUB8 r0, r1, r0

gives r0 as 0,  where r0 is 0x12345678 and r1 is 0x23456789 in ARM state, and:

  UHSUB8 r0, r1, r0

gives r0 as 0x1111be01, where r0 is 0x12345678 and r1 is 0x23456789 in thumb2 state.

This problem is present in git HEAD, (at time of writing, fd1dc858370d9a9ac7ea2512812c3a152ee6484b).
#3 lore raw
In reply to Bradley Smith

The patch has been included in v0.12.5

** Changed in: qemu
Status: New => Fix Released

Signature · 19 lines
[ARM]: SIMD add/sub instructions are incorrect
https://bugs.launchpad.net/bugs/591320
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: Fix Released

Bug description:
The thumb2 and unsigned arm state SIMD add/sub instructions are implemented incorrectly, for example:

  UQSUB8 r0, r1, r0

gives r0 as 0,  where r0 is 0x12345678 and r1 is 0x23456789 in ARM state, and:

  UHSUB8 r0, r1, r0

gives r0 as 0x1111be01, where r0 is 0x12345678 and r1 is 0x23456789 in thumb2 state.

This problem is present in git HEAD, (at time of writing, fd1dc858370d9a9ac7ea2512812c3a152ee6484b).