• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Show that we know how to translate vcmp.
2
3; REQUIRES: allow_dump
4
5; TODO(kschimpf): Use include registers for compare instructions, so that the
6; test is less brittle.
7
8; Compile using standalone assembler.
9; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -Om1 \
10; RUN:   | FileCheck %s --check-prefix=ASM
11
12; Show bytes in assembled standalone code.
13; RUN: %p2i --filetype=asm -i %s --target=arm32 --assemble --disassemble \
14; RUN:   --args -Om1 | FileCheck %s --check-prefix=DIS
15
16; Compile using integrated assembler.
17; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -Om1 \
18; RUN:   | FileCheck %s --check-prefix=IASM
19
20; Show bytes in assembled integrated code.
21; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \
22; RUN:   --args -Om1 | FileCheck %s --check-prefix=DIS
23
24define internal i32 @vcmpFloat(float %v1, float %v2) {
25; ASM-LABEL: vcmpFloat:
26; DIS-LABEL: 00000000 <vcmpFloat>:
27; IASM-LABEL: vcmpFloat:
28
29entry:
30; ASM-NEXT: .LvcmpFloat$entry:
31; IASM-NEXT: .LvcmpFloat$entry:
32
33  %cmp = fcmp olt float %v1, %v2
34
35; ASM:      vcmp.f32        s0, s1
36; DIS:   14:      eeb40a60
37; IASM-NOT: vcmp
38
39  %res = zext i1 %cmp to i32
40  ret i32 %res
41}
42
43define internal i32 @vcmpFloatToZero(float %v) {
44; ASM-LABEL: vcmpFloatToZero:
45; DIS-LABEL: 00000040 <vcmpFloatToZero>:
46; IASM-LABEL: vcmpFloatToZero:
47
48entry:
49; ASM-NEXT: .LvcmpFloatToZero$entry:
50; IASM-NEXT: .LvcmpFloatToZero$entry:
51
52  %cmp = fcmp olt float %v, 0.0
53
54; ASM:      vcmp.f32        s0, #0.0
55; DIS:   4c:      eeb50a40
56; IASM-NOT: vcmp
57
58  %res = zext i1 %cmp to i32
59  ret i32 %res
60}
61
62define internal i32 @vcmpDouble(double %v1, double %v2) {
63; ASM-LABEL: vcmpDouble:
64; DIS-LABEL: 00000080 <vcmpDouble>:
65; IASM-LABEL: vcmpDouble:
66
67entry:
68; ASM-NEXT: .LvcmpDouble$entry:
69; IASM-NEXT: .LvcmpDouble$entry:
70
71  %cmp = fcmp olt double %v1, %v2
72
73; ASM:      vcmp.f64        d0, d1
74; DIS:   94:      eeb40b41
75; IASM-NOT: vcmp
76
77  %res = zext i1 %cmp to i32
78  ret i32 %res
79}
80
81define internal i32 @vcmpDoubleToZero(double %v) {
82; ASM-LABEL: vcmpDoubleToZero:
83; DIS-LABEL: 000000c0 <vcmpDoubleToZero>:
84; IASM-LABEL: vcmpDoubleToZero:
85
86entry:
87; ASM-NEXT: .LvcmpDoubleToZero$entry:
88; IASM-NEXT: .LvcmpDoubleToZero$entry:
89
90  %cmp = fcmp olt double %v, 0.0
91
92; ASM:      vcmp.f64        d0, #0.0
93; DIS:   cc:      eeb50b40
94; IASM-NOT: vcmp
95
96  %res = zext i1 %cmp to i32
97  ret i32 %res
98}
99