When the result of an EXTRACT_SUBREG, INSERT_SUBREG, or SUBREG_TO_REG
[oota-llvm.git] / test / CodeGen / X86 / h-registers-1.ll
1 ; RUN: llvm-as < %s | llc -march=x86-64 > %t
2 ; RUN: grep {movzbl     %\[abcd\]h,} %t | count 8
3 ; RUN: grep {%\[abcd\]h} %t | not grep {%r\[\[:digit:\]\]*d}
4
5 ; LLVM creates virtual registers for values live across blocks
6 ; based on the type of the value. Make sure that the extracts
7 ; here use the GR64_NOREX register class for their result,
8 ; instead of plain GR64.
9
10 define i64 @foo(i64 %a, i64 %b, i64 %c, i64 %d,
11                 i64 %e, i64 %f, i64 %g, i64 %h) {
12   %sa = lshr i64 %a, 8
13   %A = and i64 %sa, 255
14   %sb = lshr i64 %b, 8
15   %B = and i64 %sb, 255
16   %sc = lshr i64 %c, 8
17   %C = and i64 %sc, 255
18   %sd = lshr i64 %d, 8
19   %D = and i64 %sd, 255
20   %se = lshr i64 %e, 8
21   %E = and i64 %se, 255
22   %sf = lshr i64 %f, 8
23   %F = and i64 %sf, 255
24   %sg = lshr i64 %g, 8
25   %G = and i64 %sg, 255
26   %sh = lshr i64 %h, 8
27   %H = and i64 %sh, 255
28   br label %next
29
30 next:
31   %u = add i64 %A, %B
32   %v = add i64 %C, %D
33   %w = add i64 %E, %F
34   %x = add i64 %G, %H
35   %y = add i64 %u, %v
36   %z = add i64 %w, %x
37   %t = add i64 %y, %z
38   ret i64 %t
39 }