xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/avx512-scalar.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl --show-mc-encoding | FileCheck %s --check-prefix AVX512
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx --show-mc-encoding | FileCheck %s --check-prefix AVX
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; AVX512-LABEL: @test_fdiv
5*9880d681SAndroid Build Coastguard Worker; AVX512: vdivss %xmm{{.*}} ## encoding: [0x62
6*9880d681SAndroid Build Coastguard Worker; AVX-LABEL: @test_fdiv
7*9880d681SAndroid Build Coastguard Worker; AVX:    vdivss %xmm{{.*}} ## encoding: [0xc5
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workerdefine float @test_fdiv(float %a, float %b) {
10*9880d681SAndroid Build Coastguard Worker  %c = fdiv float %a, %b
11*9880d681SAndroid Build Coastguard Worker  ret float %c
12*9880d681SAndroid Build Coastguard Worker}
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker; AVX512-LABEL: @test_fsub
15*9880d681SAndroid Build Coastguard Worker; AVX512: vsubss %xmm{{.*}} ## encoding: [0x62
16*9880d681SAndroid Build Coastguard Worker; AVX-LABEL: @test_fsub
17*9880d681SAndroid Build Coastguard Worker; AVX:    vsubss %xmm{{.*}} ## encoding: [0xc5
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Workerdefine float @test_fsub(float %a, float %b) {
20*9880d681SAndroid Build Coastguard Worker  %c = fsub float %a, %b
21*9880d681SAndroid Build Coastguard Worker  ret float %c
22*9880d681SAndroid Build Coastguard Worker}
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Worker; AVX512-LABEL: @test_fadd
25*9880d681SAndroid Build Coastguard Worker; AVX512: vaddsd %xmm{{.*}} ## encoding: [0x62
26*9880d681SAndroid Build Coastguard Worker; AVX-LABEL: @test_fadd
27*9880d681SAndroid Build Coastguard Worker; AVX:    vaddsd %xmm{{.*}} ## encoding: [0xc5
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Workerdefine double @test_fadd(double %a, double %b) {
30*9880d681SAndroid Build Coastguard Worker  %c = fadd double %a, %b
31*9880d681SAndroid Build Coastguard Worker  ret double %c
32*9880d681SAndroid Build Coastguard Worker}
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Workerdeclare float     @llvm.trunc.f32(float  %Val)
35*9880d681SAndroid Build Coastguard Workerdeclare double    @llvm.trunc.f64(double %Val)
36*9880d681SAndroid Build Coastguard Workerdeclare float     @llvm.rint.f32(float  %Val)
37*9880d681SAndroid Build Coastguard Workerdeclare double    @llvm.rint.f64(double %Val)
38*9880d681SAndroid Build Coastguard Workerdeclare double    @llvm.sqrt.f64(double %Val)
39*9880d681SAndroid Build Coastguard Workerdeclare float     @llvm.sqrt.f32(float  %Val)
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Worker; AVX512-LABEL: @test_trunc
42*9880d681SAndroid Build Coastguard Worker; AVX512: vrndscaless
43*9880d681SAndroid Build Coastguard Worker; AVX-LABEL: @test_trunc
44*9880d681SAndroid Build Coastguard Worker; AVX:    vroundss
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Workerdefine float @test_trunc(float %a) {
47*9880d681SAndroid Build Coastguard Worker  %c = call float @llvm.trunc.f32(float %a)
48*9880d681SAndroid Build Coastguard Worker  ret float %c
49*9880d681SAndroid Build Coastguard Worker}
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Worker; AVX512-LABEL: @test_sqrt
52*9880d681SAndroid Build Coastguard Worker; AVX512: vsqrtsd %xmm{{.*}} ## encoding: [0x62
53*9880d681SAndroid Build Coastguard Worker; AVX-LABEL: @test_sqrt
54*9880d681SAndroid Build Coastguard Worker; AVX:    vsqrtsd %xmm{{.*}} ## encoding: [0xc5
55*9880d681SAndroid Build Coastguard Worker
56*9880d681SAndroid Build Coastguard Workerdefine double @test_sqrt(double %a) {
57*9880d681SAndroid Build Coastguard Worker  %c = call double @llvm.sqrt.f64(double %a)
58*9880d681SAndroid Build Coastguard Worker  ret double %c
59*9880d681SAndroid Build Coastguard Worker}
60*9880d681SAndroid Build Coastguard Worker
61*9880d681SAndroid Build Coastguard Worker; AVX512-LABEL: @test_rint
62*9880d681SAndroid Build Coastguard Worker; AVX512: vrndscaless
63*9880d681SAndroid Build Coastguard Worker; AVX-LABEL: @test_rint
64*9880d681SAndroid Build Coastguard Worker; AVX:    vroundss
65*9880d681SAndroid Build Coastguard Worker
66*9880d681SAndroid Build Coastguard Workerdefine float @test_rint(float %a) {
67*9880d681SAndroid Build Coastguard Worker  %c = call float @llvm.rint.f32(float %a)
68*9880d681SAndroid Build Coastguard Worker  ret float %c
69*9880d681SAndroid Build Coastguard Worker}
70*9880d681SAndroid Build Coastguard Worker
71*9880d681SAndroid Build Coastguard Worker; AVX512-LABEL: @test_vmax
72*9880d681SAndroid Build Coastguard Worker; AVX512: vmaxss %xmm{{.*}} ## encoding: [0x62
73*9880d681SAndroid Build Coastguard Worker; AVX-LABEL: @test_vmax
74*9880d681SAndroid Build Coastguard Worker; AVX:    vmaxss %xmm{{.*}} ## encoding: [0xc5
75*9880d681SAndroid Build Coastguard Worker
76*9880d681SAndroid Build Coastguard Workerdefine float @test_vmax(float %i, float %j) {
77*9880d681SAndroid Build Coastguard Worker  %cmp_res = fcmp ogt float %i, %j
78*9880d681SAndroid Build Coastguard Worker  %max = select i1 %cmp_res, float %i, float %j
79*9880d681SAndroid Build Coastguard Worker  ret float %max
80*9880d681SAndroid Build Coastguard Worker}
81*9880d681SAndroid Build Coastguard Worker
82*9880d681SAndroid Build Coastguard Worker; AVX512-LABEL: @test_mov
83*9880d681SAndroid Build Coastguard Worker; AVX512: vcmpltss %xmm{{.*}} ## encoding: [0x62
84*9880d681SAndroid Build Coastguard Worker; AVX-LABEL: @test_mov
85*9880d681SAndroid Build Coastguard Worker; AVX:    vcmpltss %xmm{{.*}} ## encoding: [0xc5
86*9880d681SAndroid Build Coastguard Worker
87*9880d681SAndroid Build Coastguard Workerdefine float @test_mov(float %a, float %b, float %i, float %j) {
88*9880d681SAndroid Build Coastguard Worker  %cmp_res = fcmp ogt float %i, %j
89*9880d681SAndroid Build Coastguard Worker  %max = select i1 %cmp_res, float %b, float %a
90*9880d681SAndroid Build Coastguard Worker  ret float %max
91*9880d681SAndroid Build Coastguard Worker}
92*9880d681SAndroid Build Coastguard Worker
93