inn was assuming that bitfields were arrays of bytes, when actually they're

arrays of words (which makes the LSB move on big-endian systems).
This commit is contained in:
David Given 2016-12-06 21:45:20 +01:00
parent 6a77309e96
commit 55e24e1f24
2 changed files with 13 additions and 20 deletions

View file

@ -13,10 +13,10 @@
lwz r4, 4(sp) /* r4 = bit number */ lwz r4, 4(sp) /* r4 = bit number */
addi r5, sp, 8 /* r5 = base address of bit set */ addi r5, sp, 8 /* r5 = base address of bit set */
srawi r6, r4, 3 /* r6 = byte address into set */ rlwinm r6, r4, 29, 3, 29 /* r6 = byte index of word in set */
andi. r7, r4, 7 /* r7 = bit within byte */ andi. r7, r4, 31 /* r7 = bit within word */
lbzx r8, r5, r6 /* r8 = individual byte from set */ lwzx r8, r5, r6 /* r8 = individual byte from set */
sraw r8, r8, r7 sraw r8, r8, r7
rlwinm r8, r8, 0, 31, 31 rlwinm r8, r8, 0, 31, 31

View file

@ -7,10 +7,10 @@
/* Test non-existent bit */ /* Test non-existent bit */
.1 .1
rom 0I1, 0I1, 0I1, 0I1 rom 0I4
loe .1 loe .1
loc 1 /* bit number */ loc 1 /* bit number */
inn EM_WSIZE inn 4
zeq *1 zeq *1
loc __LINE__ loc __LINE__
@ -21,9 +21,12 @@
/* Test existent bit */ /* Test existent bit */
.2 .2
rom 2I1, 0I1, 0I1, 0I1 rom 16384
.21
rom 14 /* to defeat constant folding */
loe .2 loe .2
loc 1 /* bit number */ loe .21 /* bit number */
inn EM_WSIZE inn EM_WSIZE
zne *2 zne *2
@ -35,10 +38,9 @@
/* Test non-existent high bit */ /* Test non-existent high bit */
.3 .3
rom 0I1, 0I1, 0I1, 0I1 rom 0, 0
rom 0I1, 0I1, 0I1, 0I1
.31 .31
rom (EM_WSIZE*8)+1 /* to defeat constant folding */ rom 8 /* to defeat constant folding */
lae .3 lae .3
loi EM_WSIZE*2 loi EM_WSIZE*2
@ -54,16 +56,7 @@
/* Test existent high bit */ /* Test existent high bit */
.4 .4
#if EM_WSIZE == 2 rom 0, 2
rom 0I1, 0I1
rom 2I1, 0I1
#elif EM_WSIZE == 4
rom 0I1, 0I1, 0I1, 0I1
rom 2I1, 0I1, 0I1, 0I1
#else
#error Unknown word size
#endif
.41 .41
rom (EM_WSIZE*8)+1 /* to defeat constant folding */ rom (EM_WSIZE*8)+1 /* to defeat constant folding */