9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] Weird >>= operator behaviour in 5c/5l
@ 2021-01-17 21:36 Jonas Amoson
  2021-01-18  4:05 ` Noam Preil
  0 siblings, 1 reply; 9+ messages in thread
From: Jonas Amoson @ 2021-01-17 21:36 UTC (permalink / raw)
  To: 9front

Dear list,

It looks to me that the operation x >>= 0 doesn't generate the
correct result with 5c/5l (32-bit arm on Rpi 1b+). Example:

x = 2;
x >>= 0;

Gives x == 0 on arm, but on 386 it yields x == 2 as expected.
The non shorted form: x = x >> 0; Gives the correct result.
Is this a known issue, or I am missing something?

Looking at the assembly, the operation seems to be eliminated
if using the long form (giving the correct result) but using the
shorted form generates an instruction SRL $0, R1, R2, which
doesn't seem to work. Other shifts (e.g. x>>=1) do work (e.g.
generating SRL $1, R1, R2).

//Jonas Amoson

#include <u.h>
#include <libc.h>

void
main()
{
        unsigned int x = 2;
        print("%ud\n", x >>= 0);
        exits(nil);
}

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-01-21  0:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-17 21:36 [9front] Weird >>= operator behaviour in 5c/5l Jonas Amoson
2021-01-18  4:05 ` Noam Preil
2021-01-18  5:20   ` ori
2021-01-18 16:11     ` Jonas Amoson
2021-01-20  5:59       ` ori
2021-01-20  6:12         ` ori
2021-01-20 12:06           ` Jonas Amoson
2021-01-20 22:11           ` Anthony Martin
2021-01-20 23:39             ` ori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).