github.com/apache/arrow/go/v14@v14.0.1/internal/utils/Makefile (about) 1 # Licensed to the Apache Software Foundation (ASF) under one 2 # or more contributor license agreements. See the NOTICE file 3 # distributed with this work for additional information 4 # regarding copyright ownership. The ASF licenses this file 5 # to you under the Apache License, Version 2.0 (the 6 # "License"); you may not use this file except in compliance 7 # with the License. You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # this converts rotate instructions from "ro[lr] <reg>" -> "ro[lr] <reg>, 1" for yasm compatibility 18 PERL_FIXUP_ROTATE=perl -i -pe 's/(ro[rl]\s+\w{2,3})$$/\1, 1/' 19 20 C2GOASM=c2goasm 21 CC=clang-11 22 C_FLAGS=-target x86_64-unknown-none -masm=intel -mno-red-zone -mstackrealign -mllvm -inline-threshold=1000 \ 23 -fno-asynchronous-unwind-tables -fno-exceptions -fno-rtti -O3 -fno-builtin -ffast-math -fno-jump-tables -I_lib 24 ASM_FLAGS_AVX2=-mavx2 -mfma 25 ASM_FLAGS_SSE4=-msse4 26 ASM_FLAGS_BMI2=-mbmi2 27 ASM_FLAGS_POPCNT=-mpopcnt 28 29 C_FLAGS_NEON=-O3 -fvectorize -mllvm -force-vector-width=16 -fno-asynchronous-unwind-tables -mno-red-zone -mstackrealign -fno-exceptions \ 30 -fno-rtti -fno-builtin -ffast-math -fno-jump-tables -I_lib 31 32 GO_SOURCES := $(shell find . -path ./_lib -prune -o -name '*.go' -not -name '*_test.go') 33 ALL_SOURCES := $(shell find . -path ./_lib -prune -o -name '*.go' -name '*.s' -not -name '*_test.go') 34 35 .PHONEY: assembly 36 37 INTEL_SOURCES := \ 38 min_max_avx2_amd64.s min_max_sse4_amd64.s transpose_ints_avx2_amd64.s transpose_ints_sse4_amd64.s 39 40 # 41 # ARROW-15336: DO NOT add the assembly target for Arm64 (ARM_SOURCES) until c2goasm added the Arm64 support. 42 # min_max_neon_arm64.s was generated by asm2plan9s. 43 # And manually formatted it as the Arm64 Plan9. 44 # 45 46 assembly: $(INTEL_SOURCES) 47 48 _lib/min_max_avx2_amd64.s: _lib/min_max.c 49 $(CC) -S $(C_FLAGS) $(ASM_FLAGS_AVX2) $^ -o $@ ; $(PERL_FIXUP_ROTATE) $@ 50 51 _lib/min_max_sse4_amd64.s: _lib/min_max.c 52 $(CC) -S $(C_FLAGS) $(ASM_FLAGS_SSE4) $^ -o $@ ; $(PERL_FIXUP_ROTATE) $@ 53 54 _lib/min_max_neon.s: _lib/min_max.c 55 $(CC) -S $(C_FLAGS_NEON) $^ -o $@ ; $(PERL_FIXUP_ROTATE) $@ 56 57 _lib/transpose_ints_avx2_amd64.s: _lib/transpose_ints.c 58 $(CC) -S $(C_FLAGS) $(ASM_FLAGS_AVX2) $^ -o $@ ; $(PERL_FIXUP_ROTATE) $@ 59 60 _lib/transpose_ints_sse4_amd64.s: _lib/transpose_ints.c 61 $(CC) -S $(C_FLAGS) $(ASM_FLAGS_SSE4) $^ -o $@ ; $(PERL_FIXUP_ROTATE) $@ 62 63 _lib/transpose_ints_neon.s: _lib/transpose_ints.c 64 $(CC) -S $(C_FLAGS_NEON) $^ -o $@ ; $(PERL_FIXUP_ROTATE) $@ 65 66 min_max_avx2_amd64.s: _lib/min_max_avx2_amd64.s 67 $(C2GOASM) -a -f $^ $@ 68 69 min_max_sse4_amd64.s: _lib/min_max_sse4_amd64.s 70 $(C2GOASM) -a -f $^ $@ 71 72 transpose_ints_avx2_amd64.s: _lib/transpose_ints_avx2_amd64.s 73 $(C2GOASM) -a -f $^ $@ 74 75 transpose_ints_sse4_amd64.s: _lib/transpose_ints_sse4_amd64.s 76 $(C2GOASM) -a -f $^ $@ 77 78 clean: 79 rm -f $(INTEL_SOURCES) 80 rm -f $(addprefix _lib/,$(INTEL_SOURCES))