Code Monkey home page Code Monkey logo

Comments (6)

lrita avatar lrita commented on May 13, 2024

I modify the asm code to this manually

.LCPI1_0:
	.quad	-9223372036854775808    # 0x8000000000000000
        .quad	-9223372036854775808    # 0x8000000000000000
        .quad	-9223372036854775808    # 0x8000000000000000
        .quad	-9223372036854775808    # 0x8000000000000000
	.section	.rodata,"a",@progbits
.LCPI1_1:
	.long	0                       # 0x0
	.long	2                       # 0x2
	.long	4                       # 0x4
	.long	6                       # 0x6
	.zero	4
	.zero	4
	.zero	4
	.zero	4
	.text
	.globl	sample_max_avx2

and it works. Is it a correct way and a safely way?

from c2goasm.

fwessels avatar fwessels commented on May 13, 2024

Yes, that looks correct and should be ok.

from c2goasm.

lrita avatar lrita commented on May 13, 2024

@fwessels thanks for your reply.
Does clang have a flag to enable/disable move the local variables to constant? I doesnot find a relevant flag and I does not know clang well .

from c2goasm.

kannappanr avatar kannappanr commented on May 13, 2024

@iRita Sorry for responding late to your question. Looks like your question got answered on https://stackoverflow.com/questions/50126786/how-to-prevent-clang-llvm-compile-local-variables-to-global . Did you get a chance to test the suggestion? Also, clang has lots of flags that the result can be different with different combinations of flags. so, please try with the options given here https://clang.llvm.org/docs/ClangCommandLineReference.html

from c2goasm.

lrita avatar lrita commented on May 13, 2024

Hi @kannappanr,
If using -Os instead of -O3, the clang generate asm code without AVX2 instructions. It is not we wanted, we want the asm codes which is optimized for performance.

There are too many optimizations in -O3, and which one affects the move local variables to constant should be tested.

I do not find a quickly and easy way to do the test. Do I must generate the asm code by a hard way (llvm->opt->llc) ?

https://laure.gonnord.org/pro/teaching/CAP1718_ENSL/llvm_fernando.pdf

from c2goasm.

fwessels avatar fwessels commented on May 13, 2024

Hello @lrita , I am afraid you will need to do some testing on your own, clang has a ton of options and we only know the (bare) basics of it.

Going the opt / llc way is certainly another option, but these tools have their own set of flags etc so you will need to study this.

from c2goasm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.