PureBasic Forum
http://forums.purebasic.com/english/

HLT HLT HLT HLT after RET
http://forums.purebasic.com/english/viewtopic.php?f=35&t=69046
Page 1 of 1

Author:  oryaaaaa [ Sat Aug 26, 2017 2:41 am ]
Post subject:  HLT HLT HLT HLT after RET

I made Nontallion ver8.72 this week. just technique is "HLT HLT HLT HLT after RET".

PB compiler option /commented
Code:
RET


just add HLT HLT HLT HLT
Code:
RET
HLT
HLT
HLT
HLT

and /REASM compiled.

on the Intel Haswell Skylake KabyLake cores
  • Improved Display quality
  • Improved Sound quality
  • Improved Process reliability

maybe... I think "Intel inside micro OP code don't run low energy optimize!"

Test Build utility
Code:
file$=OpenFileRequester("PB", "*.pb", "*.pb", 0)
dir$ = GetPathPart(file$)
DeleteFile(dir$+"PureBasic.asm")

If file$ And FileSize(file$)>0
  Compiler = RunProgram(#PB_Compiler_Home+"\Compilers\pbcompiler", Chr(34)+file$+Chr(34)+" /MMX /UNICODE /commented", dir$, #PB_Program_Open | #PB_Program_Read); *** 3
  dir$+"PureBasic.asm"
 
  ooos.i = 0
  Output$ = ""
  If Compiler
    While ProgramRunning(Compiler)
      If AvailableProgramOutput(Compiler)
        If ooos%2 = 1
          Output$ + ReadProgramString(Compiler) + Chr(13)
        Else
          Output$ + ReadProgramString(Compiler) + Space(2)         
        EndIf
        ooos + 1
      EndIf
    Wend
    Output$ + Chr(13) + Chr(13)
    Output$ + "Exitcode: " + Str(ProgramExitCode(Compiler))
   
    CloseProgram(Compiler) ; Close the connection to the program
  EndIf
Else
  MessageRequester("Error!", "There was an error creating the assembly code file.")
EndIf

Global NewList Buffer.s()

If ReadFile(2, dir$)
  While Eof(2)=0
    AddElement(Buffer())
    Buffer() = ReadString(2)
  Wend
  CloseFile(2)
EndIf

ForEach Buffer()
  If FindString(Buffer(), " RET")
    PreviousElement(Buffer())
    AddElement(Buffer()) : Buffer() = "FNOP"
    AddElement(Buffer()) : Buffer() = "FNOP"
    NextElement(Buffer()) ; RET
    AddElement(Buffer()) : Buffer() = "HLT"
    AddElement(Buffer()) : Buffer() = "HLT"
    AddElement(Buffer()) : Buffer() = "HLT"
    AddElement(Buffer()) : Buffer() = "HLT"
    AddElement(Buffer()) : Buffer() = "FNOP"
    AddElement(Buffer()) : Buffer() = "FNOP"
  EndIf
Next

; *** MOV to MOVNTI : disable CPU cache *** It is a bonus
;
; Global NS_Find_1.i, NS_Find_2.i, NS_Find_3.i, NS_Find_4.i, NS_Find_5.i
; ForEach Buffer()
;   NS_Find_1 = FindString(Buffer(), "MOV ")
;   If NS_Find_1
;     NS_Find_2 = FindString(Buffer(), "[PB_")
;     NS_Find_3 = FindString(Buffer(), ",")
;     If NS_Find_2>0 And NS_Find_3>0 And NS_Find_2<NS_Find_3
;       Buffer() = ReplaceString(Buffer(), "MOV", "MOVNTI")
;     EndIf
;   EndIf
; Next
;
; ForEach Buffer()
;   NS_Find_1 = FindString(Buffer(), "MOV ")
;   If NS_Find_1
;     NS_Find_2 = FindString(Buffer(), "[")
;     NS_Find_3 = FindString(Buffer(), ",")
;     NS_Find_5 = FindString(LCase(Buffer()), "qword")
;     If Not NS_Find_5
;       NS_Find_5 = FindString(LCase(Buffer()), "dword")
;     EndIf
;     NS_Find_4 = FindString(LCase(Buffer()), "a", NS_Find_3)
;     If Not NS_Find_4
;       NS_Find_4 = FindString(LCase(Buffer()), "b", NS_Find_3)
;     EndIf
;     If Not NS_Find_4
;       NS_Find_4 = FindString(LCase(Buffer()), "c", NS_Find_3)
;     EndIf
;     If Not NS_Find_4
;       NS_Find_4 = FindString(LCase(Buffer()), "d", NS_Find_3)
;     EndIf
;     If Not NS_Find_4
;       NS_Find_4 = FindString(LCase(Buffer()), "p", NS_Find_3)
;     EndIf
;     If Not NS_Find_4
;       NS_Find_4 = FindString(LCase(Buffer()), "i", NS_Find_3)
;     EndIf
;     If Not NS_Find_4
;       NS_Find_4 = FindString(LCase(Buffer()), "r8", NS_Find_3)
;     EndIf
;     If Not NS_Find_4
;       NS_Find_4 = FindString(LCase(Buffer()), "r9", NS_Find_3)
;     EndIf
;     If Not NS_Find_4
;       NS_Find_4 = FindString(LCase(Buffer()), "r10", NS_Find_3)
;     EndIf
;     If Not NS_Find_4
;       NS_Find_4 = FindString(LCase(Buffer()), "r11", NS_Find_3)
;     EndIf
;     If Not NS_Find_4
;       NS_Find_4 = FindString(LCase(Buffer()), "r12", NS_Find_3)
;     EndIf
;     If Not NS_Find_4
;       NS_Find_4 = FindString(LCase(Buffer()), "r13", NS_Find_3)
;     EndIf
;     If Not NS_Find_4
;       NS_Find_4 = FindString(LCase(Buffer()), "r14", NS_Find_3)
;     EndIf
;     If Not NS_Find_4
;       NS_Find_4 = FindString(LCase(Buffer()), "r15", NS_Find_3)
;     EndIf
;     If NS_Find_2>0 And NS_Find_3>0 And NS_Find_2<NS_Find_3 And NS_Find_5>0 And NS_Find_4>0
;       Buffer() = ReplaceString(Buffer(), "MOV", "MOVNTI")
;     EndIf
;   EndIf
; Next

CreateFile(2, dir$)
ForEach Buffer()
  WriteStringN(2, Buffer())
Next
FlushFileBuffers(2)
CloseFile(2)

ClearList(Buffer())
file$ = dir$
dir$ = GetPathPart(file$)

Compiler = RunProgram(#PB_Compiler_Home+"\Compilers\pbcompiler", Chr(34)+file$+Chr(34)+" /MMX /UNICODE /REASM /EXE "+Chr(34)+"Z:\TestBuild"+Str(Random(999999))+".exe"+Chr(34), dir$, #PB_Program_Open | #PB_Program_Read)
  If Compiler
    While ProgramRunning(Compiler)
      If AvailableProgramOutput(Compiler)
        Output2$ + ReadProgramString(Compiler) + Chr(13)
      EndIf
    Wend
    Output2$ + Chr(13) + Chr(13)
    Output2$ + "Exitcode: " + Str(ProgramExitCode(Compiler))
   
    CloseProgram(Compiler)
  EndIf

  MessageRequester("Output", Output$)
  MessageRequester("Output", Output2$)

Author:  djes [ Sat Aug 26, 2017 9:29 am ]
Post subject:  Re: HLT HLT HLT HLT after RET

I think we need a fiable program to evaluate the advantages.

Author:  chi [ Sat Aug 26, 2017 9:46 am ]
Post subject:  Re: HLT HLT HLT HLT after RET

I'm curious... Do you have a small demo to see/hear the improvement?

Author:  oryaaaaa [ Sat Aug 26, 2017 5:49 pm ]
Post subject:  Re: HLT HLT HLT HLT after RET

check condition
You can't feel the effect unless you are a city along the coast.
You can’t feel in the supply area of nuclear power generation.
You can't check the effect unless you get nervous.

PB Example : Gadget.pb
It makes parts easier to see sharp.

I use this technique at Nontallion 8.72, Affeine 3.25 and All core any cures 21.4.
It is a sound player for ASIO output with the most correct sound.
Bug head 8.60, All core any cures 20.8, Affeine 3.19, Windows x64 AVX2, Installer & Zip [August2017 08/24 AM1]
x64 SSE 4.1 limited version included "Bug head 8.60, Affeine 3.19, All core any cures 20.8", Zip only
x64 AVX 2.0 Hi-legacy version included "Nontallion 8.72, Affeine 3.25, All core any cures 21.4", Zip & Installer
http://oryaaaaa.world.coocan.jp/bughead/

It is a story that the register stability is deteriorated from excessive pursuit of power saving and it is affected at the part involving DA conversion.

Author:  Fig [ Sat Aug 26, 2017 11:44 pm ]
Post subject:  Re: HLT HLT HLT HLT after RET

I Wonder if this is japanese sens of humour or if it's an automatic translation... Anyway, my city is on a coast so.... It makes me nervous :wink:

Author:  Little John [ Sun Aug 27, 2017 12:39 pm ]
Post subject:  Re: HLT HLT HLT HLT after RET

oryaaaaa wrote:
I made Nontallion ver8.72 this week. just technique is "HLT HLT HLT HLT after RET".

PB compiler option /commented
Code:
RET


just add HLT HLT HLT HLT
Code:
RET
HLT
HLT
HLT
HLT

and /REASM compiled.

oryaaaaa wrote:
check condition
You can't feel the effect unless you are a city along the coast.
You can’t feel in the supply area of nuclear power generation.
You can't check the effect unless you get nervous.

Ahhh, I see. Now everything is as clear as mud. :mrgreen:

Author:  Thorium [ Sun Aug 27, 2017 9:39 pm ]
Post subject:  Re: HLT HLT HLT HLT after RET

oryaaaaa is known for his controversial codes for quality improvement of sound and such.

Either he is a genius and understands something about how the universe works, that i and many just don't.
Or it's just plain nonsense.

Author:  Bisonte [ Sun Aug 27, 2017 11:33 pm ]
Post subject:  Re: HLT HLT HLT HLT after RET

Thorium wrote:
oryaaaaa is known for his controversial codes for quality improvement of sound and such.

Either he is a genius and understands something about how the universe works, that i and many just don't.
Or it's just plain nonsense.


Or the google translator is the greatest rubbish thing to translate from JAP to ENG...

Author:  Thorium [ Mon Aug 28, 2017 9:28 am ]
Post subject:  Re: HLT HLT HLT HLT after RET

Bisonte wrote:
Or the google translator is the greatest rubbish thing to translate from JAP to ENG...

I don't think so.
We had some discussion prior to this one. He is serious.
There are even some theoretical possibilties to some of his claims. But it's mostly esoteric.

This discussion was interessting: www.purebasic.fr/english/viewtopic.php?f=12&t=64997

Author:  Dude [ Mon Aug 28, 2017 9:36 am ]
Post subject:  Re: HLT HLT HLT HLT after RET

oryaaaaa wrote:
You can't feel the effect unless you are a city along the coast.
You can’t feel in the supply area of nuclear power generation.
You can't check the effect unless you get nervous.

Okay, now I'm convinced. This says it all.

Author:  walbus [ Wed Aug 30, 2017 3:58 pm ]
Post subject:  Re: HLT HLT HLT HLT after RET

Snake Oil

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/