我正在尝试使用SSE优化立方体功能
long cube(long n)
{
return n*n*n;
}
Run Code Online (Sandbox Code Playgroud)
我试过这个:
return (long) _mm_mul_su32(_mm_mul_su32((__m64)n,(__m64)n),(__m64)n);
Run Code Online (Sandbox Code Playgroud)
而且表现更差(是的,我从未对sse做过任何事情).
是否有可以提高性能的SSE功能?或者是其他东西?
cat/proc/cpuinfo的输出
processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Xeon(R) CPU 3070 @ 2.66GHz stepping : 6 cpu MHz : 2660.074 cache size : 4096 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : …
我目前正在针对junit测试(学校作业)进行编程
.任务是创建一个处理作业分配的有状态会话bean
submitAssignments方法应该丢弃会话bean,以便junit测试工作
jobManagementBean.submitAssignments();
// check if the bean was discarded after submitAssignments() was
// called successfully!
try {
jobManagementBean.getCache();
fail(NoSuchEJBException.class.getName() + " expected!");
} catch (NoSuchEJBException e) {
// Expected
}
Run Code Online (Sandbox Code Playgroud)
我怎么能丢弃豆子?
我正在尝试使用SIMD优化此功能,但我不知道从哪里开始.
long sum(int x,int y)
{
return x*x*x+y*y*y;
}
Run Code Online (Sandbox Code Playgroud)
反汇编函数如下所示:
4007a0: 48 89 f2 mov %rsi,%rdx
4007a3: 48 89 f8 mov %rdi,%rax
4007a6: 48 0f af d6 imul %rsi,%rdx
4007aa: 48 0f af c7 imul %rdi,%rax
4007ae: 48 0f af d6 imul %rsi,%rdx
4007b2: 48 0f af c7 imul %rdi,%rax
4007b6: 48 8d 04 02 lea (%rdx,%rax,1),%rax
4007ba: c3 retq
4007bb: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
Run Code Online (Sandbox Code Playgroud)
调用代码如下所示:
do {
for (i = 0; i < maxi; i++) { …Run Code Online (Sandbox Code Playgroud) 我有以下程序:
mnr = [0,1,2,3,4,5,6] :: [Int]
name = "Max Mustermann" :: String
kzn = "e53X" :: String
t1 = ("p1",(take 2.tail)mnr, (take 3.words.(let no n= name;in no))"No");
{-result: t1 == ("p1",[1,2],["Max","Mustermann"]) -}
Run Code Online (Sandbox Code Playgroud)
为什么忽略"否",做let no n= name;in no什么?