153 lines · plain
1; RUN: llc < %s -mtriple=ve | FileCheck %s2 3;;; Test ‘llvm.sin.*’ intrinsic4;;;5;;; Syntax:6;;; This is an overloaded intrinsic. You can use llvm.sin on any7;;; floating-point or vector of floating-point type. Not all targets8;;; 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 without24;;; trapping or setting errno.25;;;26;;; When specified with the fast-math-flag ‘afn’, the result may be27;;; approximated using a less accurate calculation.28;;;29;;; Note:30;;; We test only float/double/fp128.31 32; Function Attrs: nounwind readnone33define float @fsin_float_var(float %0) {34; CHECK-LABEL: fsin_float_var:35; CHECK: .LBB{{[0-9]+}}_2:36; CHECK-NEXT: lea %s1, sinf@lo37; CHECK-NEXT: and %s1, %s1, (32)038; CHECK-NEXT: lea.sl %s12, sinf@hi(, %s1)39; CHECK-NEXT: bsic %s10, (, %s12)40; CHECK-NEXT: or %s11, 0, %s941 %2 = tail call fast float @llvm.sin.f32(float %0)42 ret float %243}44 45; Function Attrs: nounwind readnone speculatable willreturn46declare float @llvm.sin.f32(float)47 48; Function Attrs: nounwind readnone49define double @fsin_double_var(double %0) {50; CHECK-LABEL: fsin_double_var:51; CHECK: .LBB{{[0-9]+}}_2:52; CHECK-NEXT: lea %s1, sin@lo53; CHECK-NEXT: and %s1, %s1, (32)054; CHECK-NEXT: lea.sl %s12, sin@hi(, %s1)55; CHECK-NEXT: bsic %s10, (, %s12)56; CHECK-NEXT: or %s11, 0, %s957 %2 = tail call fast double @llvm.sin.f64(double %0)58 ret double %259}60 61; Function Attrs: nounwind readnone speculatable willreturn62declare double @llvm.sin.f64(double)63 64; Function Attrs: nounwind readnone65define fp128 @fsin_quad_var(fp128 %0) {66; CHECK-LABEL: fsin_quad_var:67; CHECK: .LBB{{[0-9]+}}_2:68; CHECK-NEXT: lea %s2, sinl@lo69; CHECK-NEXT: and %s2, %s2, (32)070; CHECK-NEXT: lea.sl %s12, sinl@hi(, %s2)71; CHECK-NEXT: bsic %s10, (, %s12)72; CHECK-NEXT: or %s11, 0, %s973 %2 = tail call fast fp128 @llvm.sin.f128(fp128 %0)74 ret fp128 %275}76 77; Function Attrs: nounwind readnone speculatable willreturn78declare fp128 @llvm.sin.f128(fp128)79 80; Function Attrs: norecurse nounwind readnone81define float @fsin_float_zero() {82; CHECK-LABEL: fsin_float_zero:83; CHECK: # %bb.0:84; CHECK-NEXT: lea.sl %s0, 085; CHECK-NEXT: b.l.t (, %s10)86 ret float 0.000000e+0087}88 89; Function Attrs: norecurse nounwind readnone90define double @fsin_double_zero() {91; CHECK-LABEL: fsin_double_zero:92; CHECK: # %bb.0:93; CHECK-NEXT: lea.sl %s0, 094; CHECK-NEXT: b.l.t (, %s10)95 ret double 0.000000e+0096}97 98; Function Attrs: nounwind readnone99define 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@lo103; CHECK-NEXT: and %s0, %s0, (32)0104; 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@lo108; CHECK-NEXT: and %s2, %s2, (32)0109; CHECK-NEXT: lea.sl %s12, sinl@hi(, %s2)110; CHECK-NEXT: bsic %s10, (, %s12)111; CHECK-NEXT: or %s11, 0, %s9112 %1 = tail call fast fp128 @llvm.sin.f128(fp128 0xL00000000000000000000000000000000)113 ret fp128 %1114}115 116; Function Attrs: norecurse nounwind readnone117define float @fsin_float_const() {118; CHECK-LABEL: fsin_float_const:119; CHECK: # %bb.0:120; CHECK-NEXT: lea.sl %s0, -1083652169121; CHECK-NEXT: b.l.t (, %s10)122 ret float 0xBFED18F6E0000000123}124 125; Function Attrs: norecurse nounwind readnone126define double @fsin_double_const() {127; CHECK-LABEL: fsin_double_const:128; CHECK: # %bb.0:129; CHECK-NEXT: lea %s0, -355355578130; CHECK-NEXT: and %s0, %s0, (32)0131; CHECK-NEXT: lea.sl %s0, -1074980618(, %s0)132; CHECK-NEXT: b.l.t (, %s10)133 ret double 0xBFED18F6EAD1B446134}135 136; Function Attrs: nounwind readnone137define 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@lo141; CHECK-NEXT: and %s0, %s0, (32)0142; 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@lo146; CHECK-NEXT: and %s2, %s2, (32)0147; CHECK-NEXT: lea.sl %s12, sinl@hi(, %s2)148; CHECK-NEXT: bsic %s10, (, %s12)149; CHECK-NEXT: or %s11, 0, %s9150 %1 = tail call fast fp128 @llvm.sin.f128(fp128 0xL0000000000000000C000000000000000)151 ret fp128 %1152}153