From patchwork Mon Nov 6 16:53:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 834852 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-466046-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="XPx+T9hY"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yVzCb1Ch5z9s5L for ; Tue, 7 Nov 2017 03:53:29 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=IhUaLfkkMtPiOEmJeP1Xo2wxxXRBiR5xeZOIyrWWSd737IRbB1 pR/qZREpKso6+l1kRX6FFUJQEpY+hTsvSJxTwxkd5/q8Abavpai503f5dpESdAYg tx3S/Ute23Dsw0zHuJG/snrZKMySNQGSGjxoOnEIzDXeAmpP/kT8tRgdo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=AHlsQ1R8/q22zl48mfTO24WDIcw=; b=XPx+T9hYnEEVmMXnuqsL 5RxEK5ah0FckFMGjlI1cWAfmNlg8FKl2T2hptekfo6AGh7cLAtDYm2Qa662KJr4i L2kbXpQs72VahYQda/gdQWLTToQOfZYrvm1hzZT1iAGsOVjZ/Wh4CIZ1Wzb7KtKx bu3hnINjxDJSkdDppUxLgQ8= Received: (qmail 105595 invoked by alias); 6 Nov 2017 16:53:19 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 105524 invoked by uid 89); 6 Nov 2017 16:53:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=UD:vect-dot-s8.c, vectdotu8c, vdotcompilec, UD:vect-dot-u8.c X-HELO: EUR01-HE1-obe.outbound.protection.outlook.com Received: from mail-he1eur01on0078.outbound.protection.outlook.com (HELO EUR01-HE1-obe.outbound.protection.outlook.com) (104.47.0.78) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 06 Nov 2017 16:53:16 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Tamar.Christina@arm.com; Received: from arm.com (217.140.96.140) by DB6PR0802MB2312.eurprd08.prod.outlook.com (2603:10a6:4:86::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Mon, 6 Nov 2017 16:53:12 +0000 Date: Mon, 6 Nov 2017 16:53:39 +0000 From: Tamar Christina To: gcc-patches@gcc.gnu.org Cc: nd@arm.com, Ramana.Radhakrishnan@arm.com, Richard.Earnshaw@arm.com, nickc@redhat.com, Kyrylo.Tkachov@arm.com Subject: [PATCH][GCC][ARM] Dot Product NEON intrinsics [Patch (3/8)] Message-ID: <20171106165336.GA12409@arm.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-ClientProxiedBy: AM3PR07CA0108.eurprd07.prod.outlook.com (2603:10a6:207:7::18) To DB6PR0802MB2312.eurprd08.prod.outlook.com (2603:10a6:4:86::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fc350e4b-e685-4571-abd8-08d52536dde4 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603199)(49563074); SRVR:DB6PR0802MB2312; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2312; 3:JelL7hccnxN6SLmjf0S1JKEdmTldCffHwVSjwMay8KTABjEit1WTXkCd5q6M0RyBhacI6vrVFve/iDXbF3K18CGgTh+F112kAqEpAlTLwPzesl7N/ISFLNRyNPOVVtzZWJullXfoLFVH//z4zYAKgMpaG3/g4Gl505zEQ+/4WWG53M2xeLQsn1l4oV2AJ/sdNFvOf5YO6V3+VALZcaf+WqxMvJh5EsNYa+UzTy0aYrhu/bgnlF3/BGmuFFJ5yll2; 25:4fnhWo2lJ5wFmoA38uz/kxpviCiUSRYdbe2736+Zrv8EQ1uD1YAPTnuWKWL4qFWWT/e7FihVWv5f1RxVdrMUn7SEOHW6b6p/xYOTDnBaeObRnWwTOPrWtsWXQ/UfPNAGaqGhm66xp+0nGF4LcxJIZIJMDxPjONcPGtXue2MPyNnhE501Dk+xcCKLLhu9YadMAQNBwh17tn1lJ9ixo7hP80JkETFmAZhw+APLXgMutU3iQ1EC/couZ+BQGnB8WY9iMLATuFLzXEsBpCvpeaEgJQtabvsvswyrvJNwgsJbuHPIxNs9IazjMdq1XB+DHiXTgpP11DsYZUcA2NC+mtXGcQ==; 31:1wl5EBsotMkbhd7t+I1tOaUuyIls2PXcglHB5nM1g97huEUGhN8CT7JTHbD9y2UpDnCqtJdUzbiscQmxjkMejoHD7L1IXEckzR5q4Qzzg3/fGbc3a7nTOz6QtrNIgdeCe1KD01O1cfVB4DEJUbYXywzpRxVyvYjxDYCcz9s+4AdkXo8c2rNX23Y+pxVRHgNoNxB2hgfkQEtQbhmQncaCCOgB0NOciS/W6e0Yd770fGY= X-MS-TrafficTypeDiagnostic: DB6PR0802MB2312: X-LD-Processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2312; 20:SwpqzPgyxdrPih+sP8ogHFxotM8HZYLuPkaRTtXi2CF5W4L5yYo3l0g/eUavEktMaMDhSc7SvzoS4teD9qMac8POPlsJWKMsfwBrlS6/Xeamwg2ONeYURJ3/jXCZKaU7nb27s/Eo6N8Oq/DXz/2blaqtRRMlcHzETd8mJuTz7bw=; 4:XZsrDItm4PGHWVFZIXYaHPAfVky/VbNx1qf0yas7jYDkyD1KC4jp4d6pazNhMnq2oHwRBRXYuJlE0vllsuGO4GgjvUpemmIlatWYqzejfRI7vLq8dRqZOBpDZe5ou9ombUvipk9NdpqBAoQRP+ukyAczv1RWZMJT7m92En5oBEQYi/6oYrxWujzByLHbp3Vg/gcSLrj680ZgJfVqlUXVenbthqrAgPp5wrJwRPUBE4IGS6EA516kACCbNmr3Xz95hQDQrjYwwzc3Vgbqm6BT3jAsV67lbqVj0j8GrwYld84n6pszLDq5caIe1rb1FP2p X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(102415395)(6040450)(2401047)(8121501046)(5005006)(3231021)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041248)(20161123564025)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR0802MB2312; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR0802MB2312; X-Forefront-PRVS: 048396AFA0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(39860400002)(346002)(189002)(377424004)(199003)(53754006)(189998001)(50986999)(54356999)(16586007)(5000100001)(36756003)(4610100001)(101416001)(66066001)(97736004)(81166006)(8936002)(81156014)(58126008)(316002)(21086003)(33656002)(68736007)(83506002)(25786009)(8676002)(478600001)(2476003)(3846002)(6116002)(6916009)(86362001)(4326008)(6666003)(105586002)(1076002)(72206003)(16526018)(84326002)(55016002)(53936002)(106356001)(2906002)(2361001)(2351001)(568964002)(5890100001)(305945005)(5660300001)(7736002)(18370500001)(2700100001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0802MB2312; H:arm.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2312; 23:2ZyNkBS0LstYD/VYE1I+E6j8lJnozBXGoGJgEG/xl4BD9uS/8jm4Bm+wD8zsRX2qrdqv/7JazjFUUNtG/aVBP0cjK8DomAUs4f1bR8JmsEwVEip3P7Cjmih3uoYPnKAhR7qVNf2kavHCsMTZEXxO47T7fVeGtcIMlLqW8B6KJFNfF39WG8MTzbIHXyDeXQ8D8XyLzPuGNTNOU8sG1gcaFWZwC8c0KW9LWarDn0GGCN60BR4LeUdp7HURh1zsMUTe89BufMMHPNIG/vuP2W70ckw0vs2CFK7x3ku4hBrxBuPpg2LYY4+Z8pA1+14mRzTH4s27nLMkW/nfMOJH6VdL7VZWkPsz5loNwKFQmBeYFIQrHVqSvgRj22TMYwX88wz2oydnpYLcfU6bNx+y634OEzPBhnlEvCb/PciMjpVvpKb5CKBkxIsHVe8G+VPBoeX9UzpZVyOve3KW3JUQaMmhjd+iQeMUCqo7JHF5sAwOAwQj7724F19qnvSjw5ul2ON7Mp5vSSYDIVJ9tWy/pnsyvDx4fusZq3F15DES+kteDlCXXdKfWy2zL+QMShgaYRNrJ0rltshAePUaWXodLRort6olz5cv3hknWmMy5HwLX3OqGWP9B0o1l7uKGoz7OK3jzWKYxlcd597kzIU2/Nl817DSDEpJ/2luH3tJp3hdLnVPUPplGi1p0tKddt5tC+YOYJ0npNw/6kr8nPDX02jXLyauucTxYJxDEAyAPfB63C8nmfRe9epmoQMq5rP9CWauNPMhOCqywR2Lc2MqCJvcVFJByg1wKkd72YsU+CvkCcRfLAVVXsgJ2w9cIA1RwiGz6n+3MFRLequJs9IKRwAdK5kb4mJ1InexB8AsW4ZE9Jb2N0YDAi71KH6P+u70EEkwcF4BG3+rNa65VWPPKHpMcdXBe8VmRz4cMa9eflKwhiEj+R+Eq7q03URrPGzsNjATVEz82OAOAzQVC8/ivK08gmzkS9l6s4sX5uI4nwkasLzISNY9LH+J5EngBk+6bpCQkccXdtUnRKnSikIRTbeynfe8OEVA7vHFKUAfJUUbqavXZLOTRjAjFi97hyvv0FfKk3nB8YfUTFlngtnI4NkeoqXiNWV1DHlwJVmPga2KyVQGqKHL8RA0FrPC3UP3avcL26OBdwBomaxUxK0mOWvQLL+/FHmK5ddofvVCvIXeTLmpmKfz/ewgxXdlouwRWrwf1EOsI5glC8kUp1GBWbN82Yxyj70iRNY0IcFFjgnzV5S26FqYEUSn/UWQFnm/HHrCTfN9RYd/24mOEbuRRRdtdg== X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2312; 6:Iw3G3a+brTJtnWYhysVsLTiyN9w2YzPv/MinzhvC2RZ8BaNrJqNdRntzAlBGA79E3/NrDPEs+6GJ5jbjCSeGFWZsrGTtipB4GsLhmeJuV18lntRUBybgs5jIrTlnrFXPKlufzC5jQrmsTWHBcthhwr1klOf+UQGIBj7XkqV+ZfQu6GQ+syf3vruL2Byla9geiKSQd4mTa0oMDd9Y/7/Cvirhhs+LxbAqYm6gD5nW7vK2LQSXPcIM8egMgHB6HCsjL4+PUT6NwoBEbm51eOwToufVZ8mAb3JYC7YiN8Xh2EMXNCSZcjMbZgjBFi6YwDTDcIETzMONaH8N+KZi4fLFqJsqYwIMLIUUklqOHn4fhIE=; 5:uFiy+HTGqInhIYkQQt7l/Y0ZyPNPxp6FyT7fCSfyV2mp7TD3xA/GKDUcBLShefgji0DM7Rm2zCKIpEBFwv8XJaFOkVneCzNyyqJjx1L7ov2ubxCbpSY4cFQWluRhKxSoFI1bNfYplE18pbedyu/Xtgba9jc60VTc9ZPwg0VTf4Y=; 24:hRNBIJJbeS9KL2MoL1VMo8JyoHwn1XD9JtlmOHSr9szgZEbTsFXmaXcwHPJfJtvzwFy61NWXueCUEw+vIkWlse65Nx3r4dy3VW0mZLw7Sa0=; 7:0pWIGOZY1ZUsfd5q54qo6vNbckFGpfoZmpk5ok7vvcGfFoMHq/De+GwR8GH40HVNAbVchldZsoJs2Q/e3PSf34nDyTF3eRkdNTIOHYozCZfhFZq2WifWg15cP1Va+2P2BvlD6cG9gIwAUfvxltFkGdUnGw1LtyPIKw9ag4qn4eF7rNYlHJ/rg5gW27tsXFFRHbQGA7BUUtC40M82T69KeWrXczaDtFWY3WfOqrnlq68Zxlld1WBZBRbrz2Du+yoQ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2017 16:53:12.1037 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fc350e4b-e685-4571-abd8-08d52536dde4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2312 X-IsSubscribed: yes Hi All, This patch adds the NEON intrinsics for Dot product. Dot product is available from ARMv8.2-a and onwards. Regtested on arm-none-eabi, armeb-none-eabi, aarch64-none-elf and aarch64_be-none-elf with no issues found. Ok for trunk? gcc/ 2017-11-06 Tamar Christina * config/aarch64/arm_neon.h (vdot_u32, vdotq_u32) (vdot_s32, vdotq_s32): New. (vdot_lane_u32, vdotq_lane_u32): New. (vdot_lane_s32, vdotq_lane_s32): New. gcc/testsuite/ 2017-11-06 Tamar Christina * gcc.target/arm/simd/vdot-compile.c: New. * gcc.target/arm/simd/vect-dot-qi.h: New. * gcc.target/arm/simd/vect-dot-s8.c: New. * gcc.target/arm/simd/vect-dot-u8.c: New diff --git a/gcc/config/arm/arm_neon.h b/gcc/config/arm/arm_neon.h index 0d436e83d0f01f0c86f8d6a25f84466c841c7e11..419080417901f343737741e334cbff818bb1e70a 100644 --- a/gcc/config/arm/arm_neon.h +++ b/gcc/config/arm/arm_neon.h @@ -18034,6 +18034,72 @@ vzipq_f16 (float16x8_t __a, float16x8_t __b) #endif +/* Adv.SIMD Dot Product intrinsics. */ + +#pragma GCC push_options +#if __ARM_ARCH >= 8 +#pragma GCC target ("arch=armv8.2-a+dotprod") + +__extension__ extern __inline uint32x2_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vdot_u32 (uint32x2_t __r, uint8x8_t __a, uint8x8_t __b) +{ + return __builtin_neon_udotv8qi_uuuu (__r, __a, __b); +} + +__extension__ extern __inline uint32x4_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vdotq_u32 (uint32x4_t __r, uint8x16_t __a, uint8x16_t __b) +{ + return __builtin_neon_udotv16qi_uuuu (__r, __a, __b); +} + +__extension__ extern __inline int32x2_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vdot_s32 (int32x2_t __r, int8x8_t __a, int8x8_t __b) +{ + return __builtin_neon_sdotv8qi (__r, __a, __b); +} + +__extension__ extern __inline int32x4_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vdotq_s32 (int32x4_t __r, int8x16_t __a, int8x16_t __b) +{ + return __builtin_neon_sdotv16qi (__r, __a, __b); +} + +__extension__ extern __inline uint32x2_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vdot_lane_u32 (uint32x2_t __r, uint8x8_t __a, uint8x8_t __b, const int __index) +{ + return __builtin_neon_udot_lanev8qi_uuuus (__r, __a, __b, __index); +} + +__extension__ extern __inline uint32x4_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vdotq_lane_u32 (uint32x4_t __r, uint8x16_t __a, uint8x8_t __b, + const int __index) +{ + return __builtin_neon_udot_lanev16qi_uuuus (__r, __a, __b, __index); +} + +__extension__ extern __inline int32x2_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vdot_lane_s32 (int32x2_t __r, int8x8_t __a, int8x8_t __b, const int __index) +{ + return __builtin_neon_sdot_lanev8qi (__r, __a, __b, __index); +} + +__extension__ extern __inline int32x4_t +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) +vdotq_lane_s32 (int32x4_t __r, int8x16_t __a, int8x8_t __b, const int __index) +{ + return __builtin_neon_sdot_lanev16qi (__r, __a, __b, __index); +} + +#pragma GCC pop_options +#endif + #ifdef __cplusplus } #endif diff --git a/gcc/testsuite/gcc.target/arm/simd/vdot-compile.c b/gcc/testsuite/gcc.target/arm/simd/vdot-compile.c new file mode 100644 index 0000000000000000000000000000000000000000..a422384b0a0140d4afb4ff4a04223dd20f8d9960 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/simd/vdot-compile.c @@ -0,0 +1,55 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O3" } */ +/* { dg-require-effective-target arm_v8_2a_dotprod_neon_ok } */ +/* { dg-add-options arm_v8_2a_dotprod_neon } */ + +#include + +/* Unsigned Dot Product instructions. */ + +uint32x2_t ufoo (uint32x2_t r, uint8x8_t x, uint8x8_t y) +{ + return vdot_u32 (r, x, y); +} + +uint32x4_t ufooq (uint32x4_t r, uint8x16_t x, uint8x16_t y) +{ + return vdotq_u32 (r, x, y); +} + +uint32x2_t ufoo_lane (uint32x2_t r, uint8x8_t x, uint8x8_t y) +{ + return vdot_lane_u32 (r, x, y, 0); +} + +uint32x4_t ufooq_lane (uint32x4_t r, uint8x16_t x, uint8x8_t y) +{ + return vdotq_lane_u32 (r, x, y, 0); +} + +/* Signed Dot Product instructions. */ + +int32x2_t sfoo (int32x2_t r, int8x8_t x, int8x8_t y) +{ + return vdot_s32 (r, x, y); +} + +int32x4_t sfooq (int32x4_t r, int8x16_t x, int8x16_t y) +{ + return vdotq_s32 (r, x, y); +} + +int32x2_t sfoo_lane (int32x2_t r, int8x8_t x, int8x8_t y) +{ + return vdot_lane_s32 (r, x, y, 0); +} + +int32x4_t sfooq_lane (int32x4_t r, int8x16_t x, int8x8_t y) +{ + return vdotq_lane_s32 (r, x, y, 0); +} + +/* { dg-final { scan-assembler-times {v[us]dot\.[us]8\td[0-9]+, d[0-9]+, d[0-9]+} 4 } } */ +/* { dg-final { scan-assembler-times {v[us]dot\.[us]8\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */ +/* { dg-final { scan-assembler-times {v[us]dot\.[us]8\td[0-9]+, d[0-9]+, d[0-9]+\[#?[0-9]\]} 2 } } */ +/* { dg-final { scan-assembler-times {v[us]dot\.[us]8\tq[0-9]+, q[0-9]+, d[0-9]+\[#?[0-9]\]} 2 } } */ diff --git a/gcc/testsuite/gcc.target/arm/simd/vect-dot-qi.h b/gcc/testsuite/gcc.target/arm/simd/vect-dot-qi.h new file mode 100644 index 0000000000000000000000000000000000000000..90b00aff95cfef96d1963be17673dc191cc71169 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/simd/vect-dot-qi.h @@ -0,0 +1,15 @@ +TYPE char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); +TYPE char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); + +__attribute__ ((noinline)) int +foo1(int len) { + int i; + TYPE int result = 0; + TYPE short prod; + + for (i=0; i