1#include <stdio.h>
2
3int main(void)
4{
5 int a;
6 float b, c, d;
7 int result;
8
9 a = 0;
10 b = 124.5;
11 c = 1.4;
12 result = 1;
13 __asm
14 ("lfltd:\n\t"
15 "l.addi %0, %0, 0x1\n\t"
16 "lf.sflt.s %1, %2\n\t"
17 "l.bf lfltd\n\t"
18 "l.nop\n\t"
19 : "+r"(a)
20 : "r"(b), "r"(c)
21 );
22 if (a != result) {
23 printf("lf.sflt.s error\n");
24 return -1;
25 }
26
27 a = 0;
28 b = 11.1;
29 c = 13.1;
30 d = 1.0;
31 result = 2;
32 __asm
33 ("1:\n\t"
34 "lf.add.s %1, %1, %3\n\t"
35 "l.addi %0, %0, 1\n\t"
36 "lf.sflt.s %1, %2\n\t"
37 "l.bf 1b\n\t"
38 "l.nop\n\t"
39 : "+r"(a)
40 : "r"(b), "r"(c), "r"(d)
41 );
42 if (a != result) {
43 printf("lf.sflt.s error\n");
44 return -1;
45 }
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91 return 0;
92}
93