1; RUN: llc < %s -mtriple=ve | FileCheck %s 2 3;;; Test ‘llvm.sin.*’ intrinsic 4;;; 5;;; Syntax: 6;;; This is an overloaded intrinsic. You can use llvm.sin on any 7;;; floating-point or vector of floating-point type. Not all targets 8;;; support all types however. 9;;; 10;;; declare float @llvm.sin.f32(float %Val) 11;;; declare double @llvm.sin.f64(double %Val) 12;;; declare x86_fp80 @llvm.sin.f80(x86_fp80 %Val) 13;;; declare fp128 @llvm.sin.f128(fp128 %Val) 14;;; declare ppc_fp128 @llvm.sin.ppcf128(ppc_fp128 %Val) 15;;; 16;;; Overview: 17;;; The ‘llvm.sin.*’ intrinsics return the sine of the operand. 18;;; 19;;; Arguments: 20;;; The argument and return value are floating-point numbers of the same type. 21;;; 22;;; Semantics: 23;;; Return the same value as a corresponding libm ‘sin’ function but without 24;;; trapping or setting errno. 25;;; 26;;; When specified with the fast-math-flag ‘afn’, the result may be 27;;; approximated using a less accurate calculation. 28;;; 29;;; Note: 30;;; We test only float/double/fp128. 31 32; Function Attrs: nounwind readnone 33define float @fsin_float_var(float %0) { 34; CHECK-LABEL: fsin_float_var: 35; CHECK: .LBB{{[0-9]+}}_2: 36; CHECK-NEXT: lea %s1, sinf@lo 37; CHECK-NEXT: and %s1, %s1, (32)0 38; CHECK-NEXT: lea.sl %s12, sinf@hi(, %s1) 39; CHECK-NEXT: bsic %s10, (, %s12) 40; CHECK-NEXT: or %s11, 0, %s9 41 %2 = tail call fast float @llvm.sin.f32(float %0) 42 ret float %2 43} 44 45; Function Attrs: nounwind readnone speculatable willreturn 46declare float @llvm.sin.f32(float) 47 48; Function Attrs: nounwind readnone 49define double @fsin_double_var(double %0) { 50; CHECK-LABEL: fsin_double_var: 51; CHECK: .LBB{{[0-9]+}}_2: 52; CHECK-NEXT: lea %s1, sin@lo 53; CHECK-NEXT: and %s1, %s1, (32)0 54; CHECK-NEXT: lea.sl %s12, sin@hi(, %s1) 55; CHECK-NEXT: bsic %s10, (, %s12) 56; CHECK-NEXT: or %s11, 0, %s9 57 %2 = tail call fast double @llvm.sin.f64(double %0) 58 ret double %2 59} 60 61; Function Attrs: nounwind readnone speculatable willreturn 62declare double @llvm.sin.f64(double) 63 64; Function Attrs: nounwind readnone 65define fp128 @fsin_quad_var(fp128 %0) { 66; CHECK-LABEL: fsin_quad_var: 67; CHECK: .LBB{{[0-9]+}}_2: 68; CHECK-NEXT: lea %s2, sinl@lo 69; CHECK-NEXT: and %s2, %s2, (32)0 70; CHECK-NEXT: lea.sl %s12, sinl@hi(, %s2) 71; CHECK-NEXT: bsic %s10, (, %s12) 72; CHECK-NEXT: or %s11, 0, %s9 73 %2 = tail call fast fp128 @llvm.sin.f128(fp128 %0) 74 ret fp128 %2 75} 76 77; Function Attrs: nounwind readnone speculatable willreturn 78declare fp128 @llvm.sin.f128(fp128) 79 80; Function Attrs: norecurse nounwind readnone 81define float @fsin_float_zero() { 82; CHECK-LABEL: fsin_float_zero: 83; CHECK: # %bb.0: 84; CHECK-NEXT: lea.sl %s0, 0 85; CHECK-NEXT: b.l.t (, %s10) 86 ret float 0.000000e+00 87} 88 89; Function Attrs: norecurse nounwind readnone 90define double @fsin_double_zero() { 91; CHECK-LABEL: fsin_double_zero: 92; CHECK: # %bb.0: 93; CHECK-NEXT: lea.sl %s0, 0 94; CHECK-NEXT: b.l.t (, %s10) 95 ret double 0.000000e+00 96} 97 98; Function Attrs: nounwind readnone 99define fp128 @fsin_quad_zero() { 100; CHECK-LABEL: fsin_quad_zero: 101; CHECK: .LBB{{[0-9]+}}_2: 102; CHECK-NEXT: lea %s0, .LCPI{{[0-9]+}}_0@lo 103; CHECK-NEXT: and %s0, %s0, (32)0 104; CHECK-NEXT: lea.sl %s2, .LCPI{{[0-9]+}}_0@hi(, %s0) 105; CHECK-NEXT: ld %s0, 8(, %s2) 106; CHECK-NEXT: ld %s1, (, %s2) 107; CHECK-NEXT: lea %s2, sinl@lo 108; CHECK-NEXT: and %s2, %s2, (32)0 109; CHECK-NEXT: lea.sl %s12, sinl@hi(, %s2) 110; CHECK-NEXT: bsic %s10, (, %s12) 111; CHECK-NEXT: or %s11, 0, %s9 112 %1 = tail call fast fp128 @llvm.sin.f128(fp128 0xL00000000000000000000000000000000) 113 ret fp128 %1 114} 115 116; Function Attrs: norecurse nounwind readnone 117define float @fsin_float_const() { 118; CHECK-LABEL: fsin_float_const: 119; CHECK: # %bb.0: 120; CHECK-NEXT: lea.sl %s0, -1083652169 121; CHECK-NEXT: b.l.t (, %s10) 122 ret float 0xBFED18F6E0000000 123} 124 125; Function Attrs: norecurse nounwind readnone 126define double @fsin_double_const() { 127; CHECK-LABEL: fsin_double_const: 128; CHECK: # %bb.0: 129; CHECK-NEXT: lea %s0, -355355578 130; CHECK-NEXT: and %s0, %s0, (32)0 131; CHECK-NEXT: lea.sl %s0, -1074980618(, %s0) 132; CHECK-NEXT: b.l.t (, %s10) 133 ret double 0xBFED18F6EAD1B446 134} 135 136; Function Attrs: nounwind readnone 137define fp128 @fsin_quad_const() { 138; CHECK-LABEL: fsin_quad_const: 139; CHECK: .LBB{{[0-9]+}}_2: 140; CHECK-NEXT: lea %s0, .LCPI{{[0-9]+}}_0@lo 141; CHECK-NEXT: and %s0, %s0, (32)0 142; CHECK-NEXT: lea.sl %s2, .LCPI{{[0-9]+}}_0@hi(, %s0) 143; CHECK-NEXT: ld %s0, 8(, %s2) 144; CHECK-NEXT: ld %s1, (, %s2) 145; CHECK-NEXT: lea %s2, sinl@lo 146; CHECK-NEXT: and %s2, %s2, (32)0 147; CHECK-NEXT: lea.sl %s12, sinl@hi(, %s2) 148; CHECK-NEXT: bsic %s10, (, %s12) 149; CHECK-NEXT: or %s11, 0, %s9 150 %1 = tail call fast fp128 @llvm.sin.f128(fp128 0xL0000000000000000C000000000000000) 151 ret fp128 %1 152} 153