1 ; RUN: llc -march=hexagon < %s | FileCheck %s
3 target triple = "hexagon"
6 ; CHECK: r{{[0-9]+}} = cmpyiwh(r{{[0-9]}}:{{[0-9]}},r{{[0-9]+}}*):<<1:rnd:sat
7 define i32 @f0(double %a0) {
9 %v0 = alloca i8, align 1
10 %v1 = fptosi double %a0 to i64
11 %v2 = tail call i32 @llvm.hexagon.M4.cmpyi.whc(i64 %v1, i32 512)
12 %v3 = trunc i32 %v2 to i8
13 store volatile i8 %v3, i8* %v0, align 1
14 %v4 = load volatile i8, i8* %v0, align 1
15 %v5 = zext i8 %v4 to i32
19 ; Function Attrs: nounwind readnone
20 declare i32 @llvm.hexagon.M4.cmpyi.whc(i64, i32) #0
23 ; CHECK: r{{[0-9]+}} = cmpyrwh(r{{[0-9]}}:{{[0-9]}},r{{[0-9]+}}*):<<1:rnd:sat
24 define i32 @f1(double %a0) {
26 %v0 = alloca i8, align 1
27 %v1 = fptosi double %a0 to i64
28 %v2 = tail call i32 @llvm.hexagon.M4.cmpyr.whc(i64 %v1, i32 512)
29 %v3 = trunc i32 %v2 to i8
30 store volatile i8 %v3, i8* %v0, align 1
31 %v4 = load volatile i8, i8* %v0, align 1
32 %v5 = zext i8 %v4 to i32
36 ; Function Attrs: nounwind readnone
37 declare i32 @llvm.hexagon.M4.cmpyr.whc(i64, i32) #0
40 ; CHECK: r{{[0-9]+}} = popcount(r{{[0-9]}}:{{[0-9]}})
41 define i32 @f2(double %a0) {
43 %v0 = alloca i8, align 1
44 %v1 = fptosi double %a0 to i64
45 %v2 = tail call i32 @llvm.hexagon.S5.popcountp(i64 %v1)
46 %v3 = trunc i32 %v2 to i8
47 store volatile i8 %v3, i8* %v0, align 1
48 %v4 = load volatile i8, i8* %v0, align 1
49 %v5 = zext i8 %v4 to i32
53 ; Function Attrs: nounwind readnone
54 declare i32 @llvm.hexagon.S5.popcountp(i64) #0
57 ; CHECK: p{{[0-3]+}} = sfclass(r{{[0-9]}},#3)
58 define i32 @f3(float %a0) {
60 %v0 = alloca i8, align 1
61 %v1 = tail call i32 @llvm.hexagon.F2.sfclass(float %a0, i32 3)
62 %v2 = trunc i32 %v1 to i8
63 store volatile i8 %v2, i8* %v0, align 1
64 %v3 = load volatile i8, i8* %v0, align 1
65 %v4 = zext i8 %v3 to i32
69 ; Function Attrs: readnone
70 declare i32 @llvm.hexagon.F2.sfclass(float, i32) #1
73 ; CHECK: r{{[0-9]+}} = vasrhub(r{{[0-9]}}:{{[0-9]}},#3):sat
74 define i32 @f4(float %a0) {
76 %v0 = alloca i8, align 1
77 %v1 = fptosi float %a0 to i64
78 %v2 = tail call i32 @llvm.hexagon.S5.asrhub.sat(i64 %v1, i32 3)
79 %v3 = trunc i32 %v2 to i8
80 store volatile i8 %v3, i8* %v0, align 1
81 %v4 = load volatile i8, i8* %v0, align 1
82 %v5 = zext i8 %v4 to i32
86 ; Function Attrs: nounwind readnone
87 declare i32 @llvm.hexagon.S5.asrhub.sat(i64, i32) #0
89 attributes #0 = { nounwind readnone }
90 attributes #1 = { readnone }