1#include <stdio.h> 2 3static unsigned long test[] ={ 4 0x000000000000000a, 5 0x000000000000001a, 6 0x000000000000012a, 7 0x000000000000123a, 8 0x000000000001234a, 9 0x000000000012345a, 10 0x000000000123456a, 11 0x000000001234567a, 12 0x000000012345678a, 13 0x000000123456789a, 14 0x000001234567890a, 15 0x000000000000000b, 16 0x000000000000001b, 17 0x000000000000012b, 18 0x000000000000123b, 19 0x000000000001234b, 20 0x000000000012345b, 21 0x000000000123456b, 22 0x000000001234567b, 23 0x000000012345678b, 24 0x000000123456789b, 25 0x000001234567890b, 26 0x000000000000000c, 27 0x000000000000001c, 28 0x000000000000012c, 29 0x000000000000123c, 30 0x000000000001234c, 31 0x000000000012345c, 32 0x000000000123456c, 33 0x000000001234567c, 34 0x000000012345678c, 35 0x000000123456789c, 36 0x000001234567890c, 37 0x000000000000000d, 38 0x000000000000001d, 39 0x000000000000012d, 40 0x000000000000123d, 41 0x000000000001234d, 42 0x000000000012345d, 43 0x000000000123456d, 44 0x000000001234567d, 45 0x000000012345678d, 46 0x000000123456789d, 47 0x000001234567890d, 48 0x000000000000000e, 49 0x000000000000001e, 50 0x000000000000012e, 51 0x000000000000123e, 52 0x000000000001234e, 53 0x000000000012345e, 54 0x000000000123456e, 55 0x000000001234567e, 56 0x000000012345678e, 57 0x000000123456789e, 58 0x000001234567890e, 59 0x000000000000000f, 60 0x000000000000001f, 61 0x000000000000012f, 62 0x000000000000123f, 63 0x000000000001234f, 64 0x000000000012345f, 65 0x000000000123456f, 66 0x000000001234567f, 67 0x000000012345678f, 68 0x000000123456789f, 69 0x000001234567890f, 70 /* min and max */ 71 0x000002147483647c, 72 0x000002147483648d, 73 74/* fixs390: we also need to check if invalid values cause a fixed-point-devide exception. 75 Not yet implemented. */ 76/* 0x000002147483648c, 77 0x000002147483649d, 78 0x00000000000000fa, */ 79 80}; 81 82 83static signed int dec_to_hex(unsigned long *addr) 84{ 85 register signed int res asm("2") = 0; 86 register unsigned long *_addr asm("4") = addr; 87 88 asm volatile( 89 " cvb %0,0(0,%1)" 90 : "=d" (res) : "d" (_addr) : "memory"); 91 return res & 0xffffffff; 92} 93 94 95 96 97int main() 98{ 99 int i; 100 101 for (i = 0; i < sizeof(test) / sizeof(test[0]); i++) 102 printf("%d\n", dec_to_hex(&test[i])); 103 return 0; 104} 105