[llvm-commits] [llvm] r129012 - /llvm/trunk/lib/Target/X86/README.txt

Duncan Sands baldrick at free.fr
Thu Apr 7 01:37:16 PDT 2011


Hi Rafael,

> +The x86_64 abi says:
> +
> +Booleans, when stored in a memory object, are stored as single byte objects the
> +value of which is always 0 (false) or 1 (true).
> +
> +We are not using this fact:
> +
> +int bar(_Bool *a) { return *a; }
> +
> +define i32 @bar(i8* nocapture %a) nounwind readonly optsize {
> +  %1 = load i8* %a, align 1, !tbaa !0
> +  %tmp = and i8 %1, 1
> +  %2 = zext i8 %tmp to i32
> +  ret i32 %2
> +}

if you change i8 to i1 in the IR then you get the same code as with GCC.

Ciao, Duncan.



More information about the llvm-commits mailing list