[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Double 'andi' missed optimization
From: |
Christopher X. Candreva |
Subject: |
[avr-gcc-list] Double 'andi' missed optimization |
Date: |
Thu, 19 Jun 2003 17:35:23 -0400 (EDT) |
I've found what looks like a missed optimization in avr-gcc 3.3 20030512
uint8_t Encoder;
Encoder = (PORTD >> 4) & 12;
0: 82 b3 in r24, 0x12 ; 18
2: 82 95 swap r24
4: 8f 70 andi r24, 0x0F ; 15
6: 8c 70 andi r24, 0x0C ; 12
The 4 bit shift is implemented as a swap/andi , but with an explicit andi
afterwards, it seems like an obvious optimization to combine them.
Trivial example code below, compiled with:
avr-gcc -c e.c -g -O2 -mmcu=at90s8535 -o e.o
#include <avr/io.h>
#include <inttypes.h>
int8_t test ()
{
uint8_t Encoder;
Encoder = (PORTD >> 4) & 12;
return(Encoder);
}
==========================================================
Chris Candreva -- address@hidden -- (914) 967-7816
WestNet Internet Services of Westchester
http://www.westnet.com/
- [avr-gcc-list] Double 'andi' missed optimization,
Christopher X. Candreva <=