avr-llvm / llvm

[MERGED UPSTREAM] AVR backend for the LLVM compiler library
220 stars 21 forks source link

Implement assembler modifiers #103

Closed agnat closed 9 years ago

agnat commented 9 years ago

hi5(...) et al ;)

agnat commented 9 years ago

This is work in progress. Do not merge until further notice. ;)

agnat commented 9 years ago

I doubt any reasonable C++ compiler actually implements arithmetic shifting. In combination with promotion to signed integers (bitwise or, &c.) it's just to dangerous ... and never what you want. But I'm not an expert in these things...

Sh4rK commented 9 years ago

If you do

int32_t x = 0xff000000;
x = x >> 24;

then it actually performs an arithmetic shift (the result is 0xffffffff), so I really don't know what's going on.

agnat commented 9 years ago

Hehe, that's why it's called "implementation defined behavior" :P

I'm also pretty sure the literal 0xff000000 is actually an unsigned... anyway...

Sh4rK commented 9 years ago

Then I guess we'll never now :D

agnat commented 9 years ago

Ready for review.

@dylanmckay, could you look into adding the other fixups around here?

dylanmckay commented 9 years ago

The PR looks really nice! (it also makes me realise how much cleaner my switch statements would look if I condensed them up :P).

If you want to roll the PR into one or two commits, I'll merge :)

agnat commented 9 years ago

Squashed.

dylanmckay commented 9 years ago

I'll work on the fixup code tomorrow.