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