1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl --show-mc-encoding | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=AVX512-KNL 3 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=skx --show-mc-encoding | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=AVX512-SKX 4 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx --show-mc-encoding | FileCheck %s --check-prefix=CHECK --check-prefix=AVX 5 6 define float @test_fdiv(float %a, float %b) { 7 ; AVX512-LABEL: test_fdiv: 8 ; AVX512: ## %bb.0: 9 ; AVX512-NEXT: vdivss %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x5e,0xc1] 10 ; AVX512-NEXT: retq ## encoding: [0xc3] 11 ; 12 ; AVX-LABEL: test_fdiv: 13 ; AVX: ## %bb.0: 14 ; AVX-NEXT: vdivss %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xfa,0x5e,0xc1] 15 ; AVX-NEXT: retq ## encoding: [0xc3] 16 %c = fdiv float %a, %b 17 ret float %c 18 } 19 20 define float @test_fsub(float %a, float %b) { 21 ; AVX512-LABEL: test_fsub: 22 ; AVX512: ## %bb.0: 23 ; AVX512-NEXT: vsubss %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x5c,0xc1] 24 ; AVX512-NEXT: retq ## encoding: [0xc3] 25 ; 26 ; AVX-LABEL: test_fsub: 27 ; AVX: ## %bb.0: 28 ; AVX-NEXT: vsubss %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xfa,0x5c,0xc1] 29 ; AVX-NEXT: retq ## encoding: [0xc3] 30 %c = fsub float %a, %b 31 ret float %c 32 } 33 34 define double @test_fadd(double %a, double %b) { 35 ; AVX512-LABEL: test_fadd: 36 ; AVX512: ## %bb.0: 37 ; AVX512-NEXT: vaddsd %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfb,0x58,0xc1] 38 ; AVX512-NEXT: retq ## encoding: [0xc3] 39 ; 40 ; AVX-LABEL: test_fadd: 41 ; AVX: ## %bb.0: 42 ; AVX-NEXT: vaddsd %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xfb,0x58,0xc1] 43 ; AVX-NEXT: retq ## encoding: [0xc3] 44 %c = fadd double %a, %b 45 ret double %c 46 } 47 48 declare float @llvm.trunc.f32(float %Val) 49 declare double @llvm.trunc.f64(double %Val) 50 declare float @llvm.rint.f32(float %Val) 51 declare double @llvm.rint.f64(double %Val) 52 declare double @llvm.sqrt.f64(double %Val) 53 declare float @llvm.sqrt.f32(float %Val) 54 55 define float @test_trunc(float %a) { 56 ; AVX512-LABEL: test_trunc: 57 ; AVX512: ## %bb.0: 58 ; AVX512-NEXT: vroundss $11, %xmm0, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x0a,0xc0,0x0b] 59 ; AVX512-NEXT: retq ## encoding: [0xc3] 60 ; 61 ; AVX-LABEL: test_trunc: 62 ; AVX: ## %bb.0: 63 ; AVX-NEXT: vroundss $11, %xmm0, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0a,0xc0,0x0b] 64 ; AVX-NEXT: retq ## encoding: [0xc3] 65 %c = call float @llvm.trunc.f32(float %a) 66 ret float %c 67 } 68 69 define double @test_sqrt(double %a) { 70 ; AVX512-LABEL: test_sqrt: 71 ; AVX512: ## %bb.0: 72 ; AVX512-NEXT: vsqrtsd %xmm0, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfb,0x51,0xc0] 73 ; AVX512-NEXT: retq ## encoding: [0xc3] 74 ; 75 ; AVX-LABEL: test_sqrt: 76 ; AVX: ## %bb.0: 77 ; AVX-NEXT: vsqrtsd %xmm0, %xmm0, %xmm0 ## encoding: [0xc5,0xfb,0x51,0xc0] 78 ; AVX-NEXT: retq ## encoding: [0xc3] 79 %c = call double @llvm.sqrt.f64(double %a) 80 ret double %c 81 } 82 83 define float @test_rint(float %a) { 84 ; AVX512-LABEL: test_rint: 85 ; AVX512: ## %bb.0: 86 ; AVX512-NEXT: vroundss $4, %xmm0, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x0a,0xc0,0x04] 87 ; AVX512-NEXT: retq ## encoding: [0xc3] 88 ; 89 ; AVX-LABEL: test_rint: 90 ; AVX: ## %bb.0: 91 ; AVX-NEXT: vroundss $4, %xmm0, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0a,0xc0,0x04] 92 ; AVX-NEXT: retq ## encoding: [0xc3] 93 %c = call float @llvm.rint.f32(float %a) 94 ret float %c 95 } 96 97 define float @test_vmax(float %i, float %j) { 98 ; AVX512-LABEL: test_vmax: 99 ; AVX512: ## %bb.0: 100 ; AVX512-NEXT: vmaxss %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x5f,0xc1] 101 ; AVX512-NEXT: retq ## encoding: [0xc3] 102 ; 103 ; AVX-LABEL: test_vmax: 104 ; AVX: ## %bb.0: 105 ; AVX-NEXT: vmaxss %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xfa,0x5f,0xc1] 106 ; AVX-NEXT: retq ## encoding: [0xc3] 107 %cmp_res = fcmp ogt float %i, %j 108 %max = select i1 %cmp_res, float %i, float %j 109 ret float %max 110 } 111 112 define float @test_mov(float %a, float %b, float %i, float %j) { 113 ; AVX512-LABEL: test_mov: 114 ; AVX512: ## %bb.0: 115 ; AVX512-NEXT: vcmpltss %xmm2, %xmm3, %k1 ## encoding: [0x62,0xf1,0x66,0x08,0xc2,0xca,0x01] 116 ; AVX512-NEXT: vmovss %xmm1, %xmm0, %xmm0 {%k1} ## encoding: [0x62,0xf1,0x7e,0x09,0x10,0xc1] 117 ; AVX512-NEXT: retq ## encoding: [0xc3] 118 ; 119 ; AVX-LABEL: test_mov: 120 ; AVX: ## %bb.0: 121 ; AVX-NEXT: vcmpltss %xmm2, %xmm3, %xmm2 ## encoding: [0xc5,0xe2,0xc2,0xd2,0x01] 122 ; AVX-NEXT: vblendvps %xmm2, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x4a,0xc1,0x20] 123 ; AVX-NEXT: retq ## encoding: [0xc3] 124 %cmp_res = fcmp ogt float %i, %j 125 %max = select i1 %cmp_res, float %b, float %a 126 ret float %max 127 } 128 129 define float @zero_float(float %a) { 130 ; AVX512-KNL-LABEL: zero_float: 131 ; AVX512-KNL: ## %bb.0: 132 ; AVX512-KNL-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf0,0x57,0xc9] 133 ; AVX512-KNL-NEXT: vaddss %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x58,0xc1] 134 ; AVX512-KNL-NEXT: retq ## encoding: [0xc3] 135 ; 136 ; AVX512-SKX-LABEL: zero_float: 137 ; AVX512-SKX: ## %bb.0: 138 ; AVX512-SKX-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf0,0x57,0xc9] 139 ; AVX512-SKX-NEXT: vaddss %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x58,0xc1] 140 ; AVX512-SKX-NEXT: retq ## encoding: [0xc3] 141 ; 142 ; AVX-LABEL: zero_float: 143 ; AVX: ## %bb.0: 144 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf0,0x57,0xc9] 145 ; AVX-NEXT: vaddss %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xfa,0x58,0xc1] 146 ; AVX-NEXT: retq ## encoding: [0xc3] 147 %b = fadd float %a, 0.0 148 ret float %b 149 } 150 151 define double @zero_double(double %a) { 152 ; AVX512-KNL-LABEL: zero_double: 153 ; AVX512-KNL: ## %bb.0: 154 ; AVX512-KNL-NEXT: vxorpd %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf1,0x57,0xc9] 155 ; AVX512-KNL-NEXT: vaddsd %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfb,0x58,0xc1] 156 ; AVX512-KNL-NEXT: retq ## encoding: [0xc3] 157 ; 158 ; AVX512-SKX-LABEL: zero_double: 159 ; AVX512-SKX: ## %bb.0: 160 ; AVX512-SKX-NEXT: vxorpd %xmm1, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf1,0x57,0xc9] 161 ; AVX512-SKX-NEXT: vaddsd %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfb,0x58,0xc1] 162 ; AVX512-SKX-NEXT: retq ## encoding: [0xc3] 163 ; 164 ; AVX-LABEL: zero_double: 165 ; AVX: ## %bb.0: 166 ; AVX-NEXT: vxorpd %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf1,0x57,0xc9] 167 ; AVX-NEXT: vaddsd %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xfb,0x58,0xc1] 168 ; AVX-NEXT: retq ## encoding: [0xc3] 169 %b = fadd double %a, 0.0 170 ret double %b 171 } 172