Skip to content

Instantly share code, notes, and snippets.

@fjolnir
Created May 24, 2012 08:43
Show Gist options
  • Save fjolnir/2780255 to your computer and use it in GitHub Desktop.
Save fjolnir/2780255 to your computer and use it in GitHub Desktop.
@hello = internal constant [21 x i8] c"hello, world %d - %f\00"
declare float @llvm.cos.f32(float %Val)
declare i32 @printf(i8* noalias nocapture, ...) nounwind
define fastcc i32 @main(i32 %argc, i8** %argv) nounwind {
start:
; Cast i8 array to pointer
%ptr = getelementptr [21 x i8]* @hello, i64 0, i64 0
%cos = call float @llvm.cos.f32(float 3.0)
call i32 (i8*, ...)* @printf(i8* %ptr, i32 %argc, float %cos)
tail call fastcc i32 @main(i32 0, i8** null)
ret i32 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment