Clean up the tablegen descriptions for SparcV8.
[oota-llvm.git] / test / LLC / negintconst.ll
1 ; Test that a negative constant smaller than 64 bits (e.g., int)
2 ; is correctly implemented with sign-extension.
3 ; In particular, the current code generated is:
4 ;
5 ; main:
6 ; .L_main_LL_0:
7 ;         save    %o6, -224, %o6
8 ;         setx    .G_fmtArg_1, %o1, %o0
9 ;         setuw   1, %o1                ! i = 1
10 ;         setuw   4294967295, %o3       ! THE BUG: 0x00000000ffffffff
11 ;         setsw   0, %i0
12 ;         add     %i6, 1999, %o2        ! fval
13 ;         add     %o1, %g0, %o1
14 ;         add     %o0, 0, %o0
15 ;         mulx    %o1, %o3, %o1         ! ERROR: 0xffffffff; should be -1
16 ;         add     %o1, 3, %o1           ! ERROR: 0x100000002; should be 0x2
17 ;         mulx    %o1, 12, %o3          ! 
18 ;         add     %o2, %o3, %o3         ! produces bad address!
19 ;         call    printf
20 ;         nop     
21 ;         jmpl    %i7+8, %g0
22 ;         restore %g0, 0, %g0
23
24 ;   llc produces:
25 ; ioff = 2        fval = 0xffffffff7fffec90       &fval[2] = 0xb7fffeca8
26 ;   instead of:
27 ; ioff = 2        fval = 0xffffffff7fffec90       &fval[2] = 0xffffffff7fffeca8
28
29
30 %Results = type { float, float, float }
31
32 %fmtArg = internal global [39 x sbyte] c"ioff = %u\09fval = 0x%p\09&fval[2] = 0x%p\0A\00"; <[39 x sbyte]*> [#uses=1]
33
34 implementation
35
36 declare int "printf"(sbyte*, ...)
37
38 int "main"()
39 begin
40         %fval   = alloca %Results, uint 4
41         %i      = add uint 1, 0                                 ; i = 1
42         %iscale = mul uint %i, 4294967295                       ; i*-1 = -1
43         %ioff   = add uint %iscale, 3                           ; 3+(-i) = 2
44         %ioff   = cast uint %ioff to long
45         %fptr   = getelementptr %Results* %fval, long %ioff     ; &fval[2]
46         %castFmt = getelementptr [39 x sbyte]* %fmtArg, long 0, long 0
47         call int (sbyte*, ...)* %printf(sbyte* %castFmt, uint %ioff, %Results* %fval, %Results* %fptr)
48         ret int 0
49 end