1 ; This test makes sure that mul instructions are properly eliminated.
3 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep mul
13 %B = mul int %A, 2 ; Should convert to an add instruction
18 %B = mul int %A, 0 ; This should disappear entirely
22 double %test4(double %A) {
23 %B = mul double 1.0, %A ; This is safe for FP
32 ubyte %test6(ubyte %A) {
39 %tmp = mul int %i, -1 ; %tmp = sub 0, %i
43 ulong %test8(ulong %i) {
44 %j = mul ulong %i, 18446744073709551615 ; tmp = sub 0, %i
48 uint %test9(uint %i) {
49 %j = mul uint %i, 4294967295 ; %j = sub 0, %i
53 uint %test10(int %a, uint %b) {
55 %d = cast bool %c to uint
56 %e = mul uint %d, %b ; e = b & (a >> 31)
60 uint %test11(int %a, uint %b) {
62 %d = cast bool %c to uint
63 %e = mul uint %d, %b ; e = b & (a >> 31)
67 uint %test11(ubyte %a, uint %b) {
68 %c = setgt ubyte %a, 127
69 %d = cast bool %c to uint
70 %e = mul uint %d, %b ; e = b & (a >> 31)