Unaligned floating point access generation for powerpc

Olivier Hainque hainque@act-europe.fr
Wed Oct 22 12:55:00 GMT 2003


Hello,

On some ppc models, misaligned integer accesses are acceptable while floating
point misaligned accesses are not (undesired traps).

Using the current mainline GCC sources, the powerpc-elf O1 compilation of the
code below generates a floating point register load from a misaligned address.

How is this supposed to be handled, knowing that -mstrict-align is overkill
since it also covers integer accesses which  ?

Thanks in advance for your help,

Olivier

--

     typedef long long data_t __attribute__((aligned (1)));

     typedef struct {
       char   m_id;
       data_t m_data;
     } message_t;

     data_t data_state;

     void foo (void)
     {
       message_t m;
       data_t    data_copy = m.m_data;

       data_state  = data_copy;
     }

$ ./cc1 tt.c -quiet -O1 -o - -fverbose-asm 

# GNU C version 3.4 20031021 (experimental) (powerpc-elf)
[...]
foo:
        stwu 1,-32(1)    #,,
        lfd 0,9(1)       # m.m_data, data_copy         <===

        lis 9,data_state@ha      # tmp120,
        la 9,data_state@l(9)     # tmp119,, tmp120
        stfd 0,0(9)      # data_state, data_copy
        addi 1,1,32      #,,
        blr      #
        .size   foo, .-foo
        .comm   data_state,8,1
        .ident  "GCC: (GNU) 3.4 20031021 (experimental)"



More information about the Gcc mailing list