builtins: correct constant alignments
authorSaleem Abdulrasool <compnerd@compnerd.org>
Sat, 26 Jul 2014 21:08:34 +0000 (21:08 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Sat, 26 Jul 2014 21:08:34 +0000 (21:08 +0000)
commit15a906cf37481c4897942f267c41ada2af44414b
treeb7fbaf3be6181a94b8186df634d7727e3d2445bd
parent6c9ee7b0c8560250fcc0c023529ec9753851729a
builtins: correct constant alignments

MMX/SSE instructions expect 128-bit alignment (16-byte) for constants that they
reference.  Correct the alignment on the constant values.  Although it is quite
possible for the data to end up aligned, there is no guarantee that this will
occur unless it is explicitly aligned to the desired location.  If the data ends
up being unaligned, the resultant binary would fault at runtime due to the
unaligned access.

As an example, the follow would fault previously:
  cc -c lib/builtins/x86_64/floatundidf.S -o floatundidf.o
  cc -c test/builtins/Unit/floatundidf_test.c -o floatundidf_test.c
  ld -m elf_x86_64 floatundidf.o floatundidf_test.o -lc -o floatundidf

However, if the object files were reversed, the data would end up aligned and
the problem would go unnoticed.

llvm-svn: 214033
compiler-rt/lib/builtins/i386/floatdidf.S
compiler-rt/lib/builtins/i386/floatundidf.S
compiler-rt/lib/builtins/i386/floatundisf.S
compiler-rt/lib/builtins/i386/floatundixf.S