HNHacker News
TopNewBestAskShowJobs

cmovq

906 karma · joined October 11, 2022

submissionscomments
cmovq··on Faster asin() was hiding in plain sight
Not in this case because the dependencies are the same:

Naive: https://godbolt.org/z/Gzf1KM9Tc

Horner's: https://godbolt.org/z/jhvGqcxj1

cmovq··on Faster asin() was hiding in plain sight
Compilers cannot do this optimization for floating point [1] unless you're compiling with -ffast-math. In general, don't rely on compilers to optimize floating point sub-expressions.

[1]: https://godbolt.org/z/8bEjE9Wxx

cmovq··on Faster asin() was hiding in plain sight
> After all of the above work and that talk in mind, I decided to ask an LLM.

Impressive that an LLM managed to produce the answer from a 7 year old stack overflow answer all on its own! [1] This would have been the first search result for “fast asin” before this article was published.

[1]: https://stackoverflow.com/a/26030435

cmovq··on RISC-V Is Sloooow
But RISC-V is a _new_ ISA. Why did we start out with the wrong design that now needs a bunch of extensions? RISC-V should have taken the learnings from x86 and ARM but instead they seem to be committing the same mistakes.
cmovq··on MacBook Neo
Just turn on a light?
cmovq··on SRGB↔XYZ Conversion (2021)
> Rust programmers can take advantage of the srgb crate

I don’t like the NPMification of Cargo. Do you really need to pull in a dependency for something like this?

cmovq··on MacBook Neo
> it uses 150% scaling (as opposed to the ideal 200%) which means you have subtle display artifacts

200% is ideal but scaling on Windows has gotten really good. I use 150% on a 4K monitor and it works well.

cmovq··on Parse, Don't Validate and Type-Driven Design in Rust
Dividing a float by zero is usually perfectly valid. It has predictable outputs, and for some algorithms like collision detection this property is used to remove branches.
cmovq··on Defer available in gcc and clang
Would defer be considered hidden control flow? I guess it’s not so hidden since it’s within the same function unlike destructors, exceptions, longjmp.
cmovq··on Windows: Prefer the Native API over Win32
>> Microsoft are free to change the Native API at will, and you will be left holding both pieces when things break.

> [...] the worst case scenario is really mild: A new version of windows comes out, breaking ntdll compatibility. Zig project adds a fix to the std lib. Application developer recompiles their zig project from source, and ships an update to their users.

That assumes the application developer will continue to maintain it until the end of time.

Also "the fix" would mean developers wanting to support earlier Windows versions would need to use an older std library? Or is the library going to have runtime checks to see what Windows build its running on?

cmovq··on Windows: Prefer the Native API over Win32
Interesting, some functions explicitly mention:

> [NtQuerySystemTime may be altered or unavailable in future versions of Windows. Applications should use the GetSystemTimeAsFileTime function.] [0]

So it does seem like a bad idea for a standard library.

[0]: https://learn.microsoft.com/en-us/windows/win32/api/winternl...

cmovq··on Windows: Prefer the Native API over Win32
Is there an official stance on whether ntdll is stable? Obviously they're not going to change things arbitrarily since applications depend on it, but I'm wondering if there is a guarantee like the linux syscall interface or how you can run a win32 application compiled in 2004 on Win11.
cmovq··on I fixed Windows native development
I never understood this sentence structure, it adds zero information, it always goes like:

“This isn’t just [what the thing literally is]; it’s [hyperbole on what the thing isn’t].”

cmovq··on How many registers does an x86-64 CPU have? (2020)
If you’re asking about the register file, it’s around a couple hundred registers varying by architecture.

You’d need several usages of the ISA register without dependencies to run out of physical registers. You’re more likely to be bottlenecked by execution ports or the decoder way before that happens.

cmovq··on Vim 9.2
Vim (kind of) has it though it doesn’t render the cursors:

Ctrl-V, then move down the lines you want to edit, Shift-I to insert text on multiple lines at once.

cmovq··on 80386 Barrel Shifter
Right, it has much worse throughput:

Memory: https://uica.uops.info/tmp/f022a3c0a70e4ae5ab3588ebe65fd2a5_...

Register: https://uica.uops.info/tmp/e80e60e0c4914955b11dc6590711c1b8_...

cmovq··on Simplifying Vulkan one subsystem at a time
This is true, but what the parent comment is getting at is we really just want to be able to address graphics memory the same way it's exposed in CUDA for example. Where you can just have pointers to GPU memory in structures visible to the CPU, without this song and dance with descriptor set bindings.
cmovq··on Simplifying Vulkan one subsystem at a time
There should be a better abstraction to solve the GL state leakage problem than PSOs. We end up with a combinatory explosion of PSOs when some states they abstract are essentially toggling some bits in a GPU register in no way coupled with the rest of the pipeline state.
cmovq··on 80386 Barrel Shifter
That makes sense. LLVM could probably do better here by using the memory operand version:

https://godbolt.org/z/jeqbaPsMz

cmovq··on 80386 Barrel Shifter
> For memory operands, there's an additional twist: the bit index is a signed offset that can address bits outside the nominal operand. A bit index of 35 on a dword accesses bit 3 of the next dword in memory.

I wonder what is the use case for testing a bit outside of the memory address given.

cmovq··on 1 kilobyte is precisely 1000 bytes?
The mistake was using the "Kibi" prefix. "Kibibyte" just sounds a bit silly when said out loud.
cmovq··on Building Your Own Efficient uint128 in C++
Last time I checked LLVM had surprisingly bad codegen for this using int128. On x86 you only need two instructions:

    __asm (
        "mulq %[multiplier]\n"
        "divq %[divisor]\n"
        : "=a"(result)
        : "a"(num), [multiplier]"r"(multiplier), [divisor]"r"(divisor)
        : "rdx"
    );
The intermediate 128bit number is in rdx:rax.
cmovq··on Nintendo DS code editor and scriptable game engine
The scripting language looks like it would be more cumbersome to use than C.
cmovq··on C++ Modules Are Here to Stay
Can someone using modules chime in on whether they’ve seen build times improve?
cmovq··on Raspberry Pi Drag Race: Pi 1 to Pi 5 – Performance Comparison
Interestingly the original Pi had the same amount of memory as the PS3 which was available at the time of the Pi release. Still amazes me how much we did with only 512MB.
cmovq··on SIMD programming in pure Rust
This is true, but if you run out of the 32 register names you’ll still need to spill to memory. The large register file is to allow for multiple instructions to execute in parallel among other things.
cmovq··on No Graphics API
https://fgiesen.wordpress.com/2011/07/09/a-trip-through-the-...
cmovq··on Compiler Engineering in Practice
> A miscompile of an AI program can cause bad medical advice

I think the AI program is plenty capable of causing bad medical advice on its own without being miscompiled.

cmovq··on AMD continues to chip away at Intel's x86 market share
On data center as well. I think AMD rightly decided to focus on larger chips for data center instead of consumer laptops where margins are tiny in comparison and growth has been slow for a few years.
cmovq··on Why do we need dithering?
Dithering is still very common in rendering pipelines. 8 bits per channel is not enough to capture subtle gradients, and you’ll get tons of banding. Particularly in mostly monochrome gradients produced by light sources. So you render everything to a floating point buffer and apply dithering.

Unlike the examples in this post, this dithering is basically invisible at high resolutions, but it’s still very much in use.

← PreviousPage 2 of 5Next →