xref: /llvm-project/llvm/test/CodeGen/X86/avx512fp16-scalar.ll (revision b088536ce9e0473d6ab63c24ad69ca7ea2339a46)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512fp16 --show-mc-encoding | FileCheck %s
3
4declare half @llvm.ceil.f16(half)
5declare half @llvm.floor.f16(half)
6declare half @llvm.trunc.f16(half)
7declare half @llvm.rint.f16(half)
8declare half @llvm.nearbyint.f16(half)
9
10define half @test_ceil(half %a) {
11; CHECK-LABEL: test_ceil:
12; CHECK:       ## %bb.0:
13; CHECK-NEXT:    vrndscalesh $10, %xmm0, %xmm0, %xmm0 ## encoding: [0x62,0xf3,0x7c,0x08,0x0a,0xc0,0x0a]
14; CHECK-NEXT:    retq ## encoding: [0xc3]
15  %c = call half @llvm.ceil.f16(half %a)
16  ret half %c
17}
18
19define half @test_floor(half %a) {
20; CHECK-LABEL: test_floor:
21; CHECK:       ## %bb.0:
22; CHECK-NEXT:    vrndscalesh $9, %xmm0, %xmm0, %xmm0 ## encoding: [0x62,0xf3,0x7c,0x08,0x0a,0xc0,0x09]
23; CHECK-NEXT:    retq ## encoding: [0xc3]
24  %c = call half @llvm.floor.f16(half %a)
25  ret half %c
26}
27
28define half @test_trunc(half %a) {
29; CHECK-LABEL: test_trunc:
30; CHECK:       ## %bb.0:
31; CHECK-NEXT:    vrndscalesh $11, %xmm0, %xmm0, %xmm0 ## encoding: [0x62,0xf3,0x7c,0x08,0x0a,0xc0,0x0b]
32; CHECK-NEXT:    retq ## encoding: [0xc3]
33  %c = call half @llvm.trunc.f16(half %a)
34  ret half %c
35}
36
37define half @test_rint(half %a) {
38; CHECK-LABEL: test_rint:
39; CHECK:       ## %bb.0:
40; CHECK-NEXT:    vrndscalesh $4, %xmm0, %xmm0, %xmm0 ## encoding: [0x62,0xf3,0x7c,0x08,0x0a,0xc0,0x04]
41; CHECK-NEXT:    retq ## encoding: [0xc3]
42  %c = call half @llvm.rint.f16(half %a)
43  ret half %c
44}
45
46define half @test_nearbyint(half %a) {
47; CHECK-LABEL: test_nearbyint:
48; CHECK:       ## %bb.0:
49; CHECK-NEXT:    vrndscalesh $12, %xmm0, %xmm0, %xmm0 ## encoding: [0x62,0xf3,0x7c,0x08,0x0a,0xc0,0x0c]
50; CHECK-NEXT:    retq ## encoding: [0xc3]
51  %c = call half @llvm.nearbyint.f16(half %a)
52  ret half %c
53}
54