blob: d2c660a093cd8fb15389bcb82d33e0cecc431505 [file] [log] [blame]
Chris Lattner475cfe42005-09-29 06:11:34 +00001; Test that the memcmpOptimizer works correctly
2; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | not grep 'call.*memcmp' &&
3; RUN: llvm-as < %s | opt -simplify-libcalls -disable-output
4
5declare int %memcmp(sbyte*,sbyte*,int)
6%h = constant [2 x sbyte] c"h\00"
7%hel = constant [4 x sbyte] c"hel\00"
8%hello_u = constant [8 x sbyte] c"hello_u\00"
9
10implementation
11
12void %test(sbyte *%P, sbyte *%Q, int %N, int* %IP, bool *%BP) {
13 %A = call int %memcmp(sbyte *%P, sbyte* %P, int %N)
14 volatile store int %A, int* %IP
15 %B = call int %memcmp(sbyte *%P, sbyte* %Q, int 0)
16 volatile store int %B, int* %IP
17 %C = call int %memcmp(sbyte *%P, sbyte* %Q, int 1)
18 volatile store int %C, int* %IP
19 %D = call int %memcmp(sbyte *%P, sbyte* %Q, int 2)
20 %E = seteq int %D, 0
21 volatile store bool %E, bool* %BP
22 ret void
23}