1*d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only 201956597SArd Biesheuvel /* 301956597SArd Biesheuvel * linux/arch/arm/lib/xor-neon.c 401956597SArd Biesheuvel * 501956597SArd Biesheuvel * Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org> 601956597SArd Biesheuvel */ 701956597SArd Biesheuvel 801956597SArd Biesheuvel #include <linux/raid/xor.h> 99319206dSArd Biesheuvel #include <linux/module.h> 109319206dSArd Biesheuvel 119319206dSArd Biesheuvel MODULE_LICENSE("GPL"); 1201956597SArd Biesheuvel 1301956597SArd Biesheuvel #ifndef __ARM_NEON__ 14de9c0d49SNathan Chancellor #error You should compile this file with '-march=armv7-a -mfloat-abi=softfp -mfpu=neon' 1501956597SArd Biesheuvel #endif 1601956597SArd Biesheuvel 1701956597SArd Biesheuvel /* 1801956597SArd Biesheuvel * Pull in the reference implementations while instructing GCC (through 1901956597SArd Biesheuvel * -ftree-vectorize) to attempt to exploit implicit parallelism and emit 2001956597SArd Biesheuvel * NEON instructions. 2101956597SArd Biesheuvel */ 2201956597SArd Biesheuvel #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) 2301956597SArd Biesheuvel #pragma GCC optimize "tree-vectorize" 2401956597SArd Biesheuvel #else 2501956597SArd Biesheuvel /* 2601956597SArd Biesheuvel * While older versions of GCC do not generate incorrect code, they fail to 2701956597SArd Biesheuvel * recognize the parallel nature of these functions, and emit plain ARM code, 2801956597SArd Biesheuvel * which is known to be slower than the optimized ARM code in asm-arm/xor.h. 2901956597SArd Biesheuvel */ 3001956597SArd Biesheuvel #warning This code requires at least version 4.6 of GCC 3101956597SArd Biesheuvel #endif 3201956597SArd Biesheuvel 3301956597SArd Biesheuvel #pragma GCC diagnostic ignored "-Wunused-variable" 3401956597SArd Biesheuvel #include <asm-generic/xor.h> 3501956597SArd Biesheuvel 3601956597SArd Biesheuvel struct xor_block_template const xor_block_neon_inner = { 3701956597SArd Biesheuvel .name = "__inner_neon__", 3801956597SArd Biesheuvel .do_2 = xor_8regs_2, 3901956597SArd Biesheuvel .do_3 = xor_8regs_3, 4001956597SArd Biesheuvel .do_4 = xor_8regs_4, 4101956597SArd Biesheuvel .do_5 = xor_8regs_5, 4201956597SArd Biesheuvel }; 439319206dSArd Biesheuvel EXPORT_SYMBOL(xor_block_neon_inner); 44