GCC-SH: more regmove weakness
Toshi Morita
tm2@best.com
Mon Oct 16 17:46:00 GMT 2000
host: i386-linux
target: sh-elf
version: CVS 10/16/2000
When the file:
#include <stream.h>
class Matrix {
public:
Matrix(float v11, float v12, float v13, float v14,
float v21, float v22, float v23, float v24,
float v31, float v32, float v33, float v34,
float v41, float v42, float v43, float v44);
void dump(void);
private:
float value[4][4];
};
Matrix::Matrix(float v11, float v12, float v13, float v14,
float v21, float v22, float v23, float v24,
float v31, float v32, float v33, float v34,
float v41, float v42, float v43, float v44)
{
value[0][0] = v11;
value[0][1] = v12;
value[0][2] = v13;
value[0][3] = v14;
value[1][0] = v21;
value[1][1] = v22;
value[1][2] = v23;
value[1][3] = v24;
value[2][0] = v31;
value[2][1] = v32;
value[2][2] = v33;
value[2][3] = v34;
value[3][0] = v41;
value[3][1] = v42;
value[3][2] = v43;
value[3][3] = v44;
}
void Matrix::dump(void)
{
cout << value[0][0] << ' ' << value[0][1] << ' ' << value[0][2] << ' ' << value[0][3] << '\n';
cout << value[1][0] << ' ' << value[1][1] << ' ' << value[1][2] << ' ' << value[1][3] << '\n';
cout << value[2][0] << ' ' << value[2][1] << ' ' << value[2][2] << ' ' << value[2][3] << '\n';
cout << value[3][0] << ' ' << value[3][1] << ' ' << value[3][2] << ' ' << value[3][3] << '\n';
}
void main(void)
{
Matrix matrix( 0.0f, 1.0f, 2.0f, 3.0f,
4.0f, 5.0f, 6.0f, 7.0f,
8.0f, 9.0f, 10.0f, 11.0f,
12.0f, 13.0f, 14.0f, 15.0f);
matrix.dump();
}
is compiled with the following options:
sh-elf-g++ -O2 -m4-single-only -ml -S test.cpp
the following code is emitted:
___6Matrixffffffffffffffff:
mov.l r14,@-r15
mov #20,r2
fmov.s fr12,@-r15
fmov.s fr13,@-r15
fmov.s fr14,@-r15
fmov.s fr15,@-r15
mov r15,r14
add r14,r2
mov r2,r1
fmov.s @r1+,fr1
fmov.s @r1,fr2
mov r14,r1
add #28,r1
fmov.s @r1,fr3 <- failed to generate post-increment
add #4,r1
fmov.s @r1,fr0 <- ditto
add #4,r1
fmov.s @r1,fr12 <- ditto
add #4,r1
fmov.s @r1,fr13 <- ditto
add #4,r1
fmov.s @r1,fr14 <- ditto
add #4,r1
fmov.s @r1,fr15 <- ditto
fmov.s fr4,@r4
add #4,r4
...
Toshi
More information about the Gcc-bugs
mailing list