1 // RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null
8 main(int argc
, char** argv
)
14 unsigned char ubc0
, uc2
;
15 unsigned short us2
, usf1
, usd1
;
16 int ic3
, is3
, sif1
, sid1
;
17 unsigned int uic4
, uis4
, uif1
, uid1
;
19 unsigned long ulf1
, uld1
;
23 /* Test integer to integer conversions */
25 c1
= (char) (argc
>= 2)? atoi(argv
[1]) : 0xff64; /* 100 = 'd' */
26 s1
= (short) (argc
>= 3)? atoi(argv
[2]) : -769; /* 0xf7ff = -769 */
28 ubc0
= (unsigned char) c1
; /* 100 = 'd' */
29 ubs0
= (unsigned char) s1
; /* 0xff = 255 */
30 bs0
= (signed char) s1
; /* 0xff = -1 */
32 uc2
= (unsigned char) c1
; /* 100 = 'd' */
33 us2
= (unsigned short) s1
; /* 0xf7ff = 64767 */
35 ic3
= (int) c1
; /* 100 = 'd' */
36 is3
= (int) s1
; /* 0xfffff7ff = -769 */
38 uic4
= (unsigned int) c1
; /* 100 = 'd' */
39 uis4
= (unsigned int) s1
; /* 0xfffff7ff = 4294966527 */
41 printf("ubc0 = '%c'\n", ubc0
);
42 printf("ubs0 = %u\n", ubs0
);
43 printf("bs0 = %d\n", bs0
);
44 printf("c1 = '%c'\n", c1
);
45 printf("s1 = %d\n", s1
);
46 printf("uc2 = '%c'\n", uc2
);
47 printf("us2 = %u\n", us2
);
48 printf("ic3 = '%c'\n", ic3
);
49 printf("is3 = %d\n", is3
);
50 printf("uic4 = '%c'\n", uic4
);
51 printf("uis4 = %u\n", uis4
);
53 /* Test floating-point to integer conversions */
54 f1
= (float) (argc
>= 4)? atof(argv
[3]) : 1.0;
55 d1
= (argc
>= 5)? atof(argv
[4]) : 2.0;
57 usf1
= (unsigned short) f1
;
58 usd1
= (unsigned short) d1
;
59 uif1
= (unsigned int) f1
;
60 uid1
= (unsigned int) d1
;
61 ulf1
= (unsigned long) f1
;
62 uld1
= (unsigned long) d1
;
71 printf("usf1 = %u\n", usf1
);
72 printf("usd1 = %u\n", usd1
);
73 printf("uif1 = %u\n", uif1
);
74 printf("uid1 = %u\n", uid1
);
75 printf("ulf1 = %u\n", ulf1
);
76 printf("uld1 = %u\n", uld1
);
78 printf("ssf1 = %d\n", ssf1
);
79 printf("ssd1 = %d\n", ssd1
);
80 printf("sif1 = %d\n", sif1
);
81 printf("sid1 = %d\n", sid1
);
82 printf("slf1 = %d\n", slf1
);
83 printf("sld1 = %d\n", sld1
);