This is a clean-room implementation based on public documentation and I tried to validate it as much as possible against gcc. llvm-svn: 157638