blob: f5a2a8f9e81e105cc05c8ffad1dcfc4f357893cf [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; PR1022, PR1023
2; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | \
3; RUN: grep 3721182122 | wc -l | grep 2
4; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | \
5; RUN: grep -E {movl _?bytes2} | wc -l | grep 1
6
7%fmt = constant [4 x sbyte] c"%x\0A\00"
8%bytes = constant [4 x sbyte] c"\AA\BB\CC\DD"
9%bytes2 = global [4 x sbyte] c"\AA\BB\CC\DD"
10
11
12int %test1() {
13 %y = alloca uint
14 %c = cast uint* %y to sbyte*
15 %z = getelementptr [4 x sbyte]* %bytes, int 0, int 0
16 call void %llvm.memcpy.i32( sbyte* %c, sbyte* %z, uint 4, uint 1 )
17 %r = load uint* %y
18 %t = cast [4 x sbyte]* %fmt to sbyte*
19 %tmp = call int (sbyte*, ...)* %printf( sbyte* %t, uint %r )
20 ret int 0
21}
22
23void %test2() {
24 %y = alloca uint
25 %c = cast uint* %y to sbyte*
26 %z = getelementptr [4 x sbyte]* %bytes2, int 0, int 0
27 call void %llvm.memcpy.i32( sbyte* %c, sbyte* %z, uint 4, uint 1 )
28 %r = load uint* %y
29 %t = cast [4 x sbyte]* %fmt to sbyte*
30 %tmp = call int (sbyte*, ...)* %printf( sbyte* %t, uint %r )
31 ret void
32}
33
34declare void %llvm.memcpy.i32(sbyte*, sbyte*, uint, uint)
35declare int %printf(sbyte*, ...)